Commit 6b8fb05a authored by Antoine Beaupré's avatar Antoine Beaupré

remove duplicate code between linux and freebsd

now everything is managed through parameters

we still don't install the package on platforms other than freebsd and
linux to respect the current policy, so this actually is just a refactoring
parent 92073a73
class sudo::base {
if $sudo::deploy_sudoers {
file {
$sudo::path:
source => [ "puppet:///modules/site_sudo/sudoers/${::fqdn}/sudoers",
"puppet:///modules/site_sudo/sudoers/sudoers",
"puppet:///modules/sudo/sudoers/${::operatingsystem}/sudoers",
"puppet:///modules/sudo/sudoers/sudoers" ],
owner => root, group => 0, mode => 0440;
}
}
file {
$sudo::dir:
ensure => directory,
owner => root, group => 0, mode => 0550;
}
}
class sudo::freebsd inherits sudo::base {
package{'sudo':
ensure => installed,
}
}
......@@ -8,8 +8,28 @@ class sudo(
$dir = $sudo::params::dir
) inherits sudo::params {
case $::kernel {
linux: { include sudo::linux }
freebsd: { include sudo::freebsd }
default: { include sudo::base }
# XXX: why don't we install the package everywhere?
linux,freebsd: {
package {'sudo':
ensure => installed,
}
}
}
if $sudo::deploy_sudoers {
file {
$sudo::path:
source => [ "puppet:///modules/site_sudo/sudoers/${::fqdn}/sudoers",
"puppet:///modules/site_sudo/sudoers/sudoers",
"puppet:///modules/sudo/sudoers/${::operatingsystem}/sudoers",
"puppet:///modules/sudo/sudoers/sudoers" ],
require => Package['sudo'],
owner => root, group => 0, mode => 0440;
}
}
file {
$sudo::dir:
ensure => directory,
require => Package['sudo'],
owner => root, group => 0, mode => 0550;
}
}
class sudo::linux inherits sudo::base {
package{'sudo':
ensure => installed,
}
if $sudo_deploy_sudoers {
File['/etc/sudoers']{
require => Package['sudo'],
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment