Added custom::rootpassword class which set's root password to given hash.

This commit is contained in:
Timo Mkinen 2009-09-17 17:06:34 +03:00
parent d384b2aa57
commit 685ecc9810

View file

@ -18,3 +18,35 @@ class custom {
}
}
# Set root password
#
# === Global variables
#
# $root_password:
# Root password hash to set.
#
class custom::rootpassword {
if ! $root_password {
fail("Root password hash not defined.")
}
case $operatingsystem {
openbsd: {
exec { "usermod -p \${SECRET} root":
environment => "SECRET=${root_password}",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
unless => 'test "`sed -n \'s/^root:\([a-zA-Z0-9\.\$]*\):.*/\1/p\' /etc/master.passwd`" = "${SECRET}"',
}
}
default: {
user { "root":
ensure => present,
password => "${root_password}",
}
}
}
}