I've encouter some problems with my module Timezone in Puppet.
So to make it short and clear, I'm in an internship and my boss gave me an assignement : Fix the automated creation of a VM.
The creation use .yaml file with details about the VM inside (CPU,RAM,IP,Backup etc ...) then a html page is make with a makefile with the details of the VM and the xenconf (the cfg file) too.
When a VM is created there is a script that install some packages (whose puppet).
Now I've some problems :
The VM don't have the good time, they're all in UTC and we want them with the localtime of Paris (Europe). First I tried to distribute directly the file but that wasn't working after some research, I tried to use link but the link is not correct, I've a symlink to UTC instead of Europe/Paris. There is my init.pp file for my timezone class :
#
# config de ntpd
#
# $Id: init.pp 5149 2015-07-01 16:11:29Z k***.a**** $
#
# Configuration de la timezone
class timezone {
# Fichier de configuration
file { 'timezone':
path => '/etc/timezone',
ensure => file,
source => 'puppet:///modules/timezone/timezone',
}
## Fichier de configuration
# file { 'localtime':
# path => '/etc/localtime',
# ensure => file,
# source => 'puppet:///modules/timezone/Europe/Paris',
# }
file { '/etc/localtime':
require => Package["tzdata"],
ensure => link,
force => yes,
target => '/usr/share/zoneinfo/Europe/Paris',
}
exec { 'update_date':
command => 'dpkg-reconfigure -f noninteractive tzdata',
path => '/usr/local/bin/:/bin/',
#refreshonly => true,
}
}
There is some commands I tried, to check my symlink :
ls -F : localtime@
root@testcreationvm:/etc# file localtime
localtime: symbolic link to /usr/share/zoneinfo/Etc/UTC
I've one more issue with this module, it's how I can exec the command above (dpkg-reconfigure -f noninteractive tzdata), one time at the creation and after that each time the file or link is modified.
Thx by advance :)
PS : All the VM are Debians (from 7 to 9).