make the sudoers directory parametrized

This commit is contained in:
Antoine Beaupré 2013-06-22 12:38:41 -04:00
parent b6cd3ed6ce
commit f02dcffe22
6 changed files with 11 additions and 4 deletions

View file

@ -36,4 +36,4 @@ root ALL=(ALL) ALL
# Samples # Samples
# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom # %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users localhost=/sbin/shutdown -h now # %users localhost=/sbin/shutdown -h now
#includedir /etc/sudoers.d #includedir /usr/local/etc/sudoers.d

View file

@ -7,7 +7,7 @@ define sudo::access (
$user = $name $user = $name
} }
# there shouldn't be a dot in those filenames! # there shouldn't be a dot in those filenames!
file { "/etc/sudoers.d/01-user_access-${title}": file { "${sudo::sudoersdir}/01-user_access-${title}":
ensure => 'present', ensure => 'present',
owner => 'root', owner => 'root',
group => 0, group => 0,

View file

@ -7,5 +7,9 @@ class sudo::base {
"puppet:///modules/sudo/sudoers/sudoers" ], "puppet:///modules/sudo/sudoers/sudoers" ],
owner => root, group => 0, mode => 0440; owner => root, group => 0, mode => 0440;
} }
file { ${sudo::sudoersdir}:
ensure => directory,
owner => root, group => 0, mode => 0550;
}
} }
} }

View file

@ -1,4 +1,6 @@
class sudo::freebsd inherits sudo::base { class sudo::freebsd inherits sudo::base {
class { 'sudo': sudoersdir => '/usr/local/etc/sudoers.d' }
package{'sudo': package{'sudo':
ensure => installed, ensure => installed,
} }

View file

@ -3,7 +3,8 @@
# GPLv3 # GPLv3
class sudo( class sudo(
$deploy_sudoers = false $deploy_sudoers = false,
$sudoersdir = '/etc/sudoers.d',
) { ) {
case $::kernel { case $::kernel {
linux: { include sudo::linux } linux: { include sudo::linux }

View file

@ -3,7 +3,7 @@ define sudo::user_alias (
$ensure = 'present' $ensure = 'present'
) { ) {
# this is 00-prefixed so that it's defined before the other definitions # this is 00-prefixed so that it's defined before the other definitions
file { "/etc/sudoers.d/00-user_alias-${title}": file { "${sudo::sudoersdir}/etc/sudoers.d/00-user_alias-${title}":
ensure => $ensure, ensure => $ensure,
owner => 'root', owner => 'root',
group => 0, group => 0,