Skip to content

Instantly share code, notes, and snippets.

@saz
Last active June 20, 2018 05:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saz/454e5c2eed03a3728a0708a41c4989fc to your computer and use it in GitHub Desktop.
Save saz/454e5c2eed03a3728a0708a41c4989fc to your computer and use it in GitHub Desktop.
hiera and variables inside a string - possible?
class timezone (
String $timezone = 'Etc/UTC',
Optional[String] $timezone_update = undef
) {
# data from hiera with a variable inside?
if $timezone_update {
exec { 'update_timezone':
command => $timezone_update,
}
}
# Different commands per osfamily within the same module
# on some systems, the timezone is required
# Gentoo
timezone::timezone_update: 'emerge --config timezone-data'
# Debian
timezone::timezone_update: 'dpkg-reconfigure -f noninteractive tzdata'
# Suse, needs value of timezone
timezone::timezone_update: 'zic -l ${timezone}'
# RedHat >= 7, needs value of timezone
timezone::timezone_update: 'timedatectl set-timezone ${timezone}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment