puppet/custom/manifests/init.pp

52 lines
1 KiB
Puppet

class custom {
file { "/srv":
ensure => directory,
mode => 0755,
owner => root,
group => $operatingsystem ? {
OpenBSD => wheel,
default => root,
},
}
if $kernel == OpenBSD {
Service {
provider => openbsd,
}
}
}
# 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}",
}
}
}
}