lint manifests

respect style from best practices. this makes the code a lot easier to
read.

also change groups from "root" to "0" to make them more portable (e.g.
in freebsd, the admin group is "wheel" but has gid "0")
This commit is contained in:
Gabriel Filion 2013-04-25 18:58:04 -04:00
parent d705c23880
commit 9c4d6fc6ec
3 changed files with 43 additions and 32 deletions

View file

@ -1,13 +1,17 @@
define sudo::access($ensure = 'present', $user = undef, $access = 'ALL=(ALL) ALL') {
if $user == undef {
$user = $name
}
# there shouldn't be a dot in those filenames!
file { "/etc/sudoers.d/01-user_access-${title}":
ensure => 'present',
owner => root,
group => root,
mode => 0440,
content => "# THIS FILE IS MANAGED BY PUPPET !\n${user} ${access}\n",
}
define sudo::access (
$ensure = 'present',
$user = undef,
$access = 'ALL=(ALL) ALL'
) {
if $user == undef {
$user = $name
}
# there shouldn't be a dot in those filenames!
file { "/etc/sudoers.d/01-user_access-${title}":
ensure => 'present',
owner => 'root',
group => 0,
mode => '0440',
content => "# THIS FILE IS MANAGED BY PUPPET !\n${user} ${access}\n",
}
}

View file

@ -1,15 +1,19 @@
class sudo {
package { 'sudo': ensure => installed, }
package { 'sudo': ensure => installed, }
file { "/etc/sudoers":
mode => 440, owner => root, group => 0,
require => Package['sudo'],
source => [ "puppet:///secrets/sudoers.$fqdn", "puppet:///secrets/sudoers" ],
}
if $operatingsystem == 'FreeBSD' {
File["/etc/sudoers"] {
path => "/usr/local/etc/sudoers",
source => [ "puppet:///secrets/sudoers.$fqdn", "puppet:///secrets/sudoers.FreeBSD" ],
}
file { '/etc/sudoers':
source => ["puppet:///secrets/sudoers.${::fqdn}",
'puppet:///secrets/sudoers' ],
mode => '0440',
owner => 'root',
group => 0,
require => Package['sudo'],
}
if $::operatingsystem == 'FreeBSD' {
File['/etc/sudoers'] {
path => '/usr/local/etc/sudoers',
source => [ "puppet:///secrets/sudoers.${::fqdn}",
'puppet:///secrets/sudoers.FreeBSD' ],
}
}
}

View file

@ -1,10 +1,13 @@
define sudo::user-alias ($ensure = 'present', $members) {
# this is 00-prefixed so that it's defined before the other definitions
file { "/etc/sudoers.d/00-user_alias-${title}":
ensure => $ensure,
owner => root,
group => root,
mode => 440,
content => "# THIS FILE IS MANAGED BY PUPPET !\n\nUser_Alias ${name} = ${members}\n",
}
define sudo::user-alias (
$members,
$ensure = 'present'
) {
# this is 00-prefixed so that it's defined before the other definitions
file { "/etc/sudoers.d/00-user_alias-${title}":
ensure => $ensure,
owner => 'root',
group => 0,
mode => '0440',
content => "# THIS FILE IS MANAGED BY PUPPET !\n\nUser_Alias ${name} = ${members}\n",
}
}