Setting Debian time zone with puppet

To manually change the time zone on a Debian install you would naturally use the interactive command dpkg-reconfigure tzdata.

In order to change all your puppet managed machines at once I use this simple recipe:

#
# Timezone -> America/Sao_Paulo
#

package {'tzdata':
  ensure  => 'present'
}

file {'/etc/localtime':
  require => Package['tzdata'],
  source  => 'file:///usr/share/zoneinfo/America/Sao_Paulo',
  notify  => Exec['reboot']
}

file {'/etc/timezone':
  require => Package['tzdata'],
  content => 'America/Sao_Paulo',
  notify  => Exec['reboot']
}

That’s it!

One thought on “Setting Debian time zone with puppet

Comments are closed.