I'm using puppet to admin a cluster of debian servers. I need to change the timezone of each machine on the cluster. The proper debian way to do this is to use dpkg-reconfigure tzdata
. But I can only seem to change it if I use the dialog. Is there some way to automate this from the shell so I can just write an Exec to make this easy?
If not, I think the next best way would probably be to have puppet distribute /etc/timezone
and /etc/localtime
with the correct data across the cluster.
Any input appreciated!
Best Answer
You need to specify the frontend as `noninteractive' and it will save your current settings.
dpkg-reconfigure will take the current system settings as gospel, so simply change your timezone the way you would normally and run it with the non-interactive flag
e.g. for me to change to "Europe/Dublin" where I am:
Obviously this allows you to use puppet/cfengine as you like to distribute /etc/timezone also.
EDIT:
after @gertvdijk comment pointing to https://bugs.launchpad.net/ubuntu/+source/tzdata/+bug/1554806 and @scruss answer you will probably have to do it like this in most modern distributions: