Created
February 27, 2013 15:27
-
-
Save frimik/5048736 to your computer and use it in GitHub Desktop.
user::root class
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 user::root { | |
# Whitelist means we DON'T manage the passwords. | |
# For the old fashioned people who don't know what an ENC is. | |
$whitelist_fqdn_array = ['funkyserver1.domain.int'] | |
# valid password regexes | |
$valid_password_array = ['^\$1\$.{25,}', '^\$foreman\$.{15,}'] | |
if $::root_pw and !member($whitelist_fqdn_array, $::fqdn) { | |
# If root_pw is set and matches one of our well known password formats, go | |
# ahead and set it | |
case $::manage_root_password { | |
true,"true": { | |
validate_re($::root_pw, $valid_password_array) | |
class{"user::root::password": | |
ensure => present, | |
password => $::root_pw, | |
stage => "setup", | |
} | |
} | |
default: { | |
# What do you know? It's a no-op! | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment