Last active
June 20, 2018 05:44
-
-
Save saz/454e5c2eed03a3728a0708a41c4989fc to your computer and use it in GitHub Desktop.
hiera and variables inside a string - possible?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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