Defined Type: sudo::group
- Defined in:
- modules/sudo/manifests/group.pp
Overview
SPDX-License-Identifier: Apache-2.0
Define: sudo::group
Manages a sudo specification in /etc/sudoers.d.
Parameters
- privileges
-
Array of sudo privileges.
- group
-
User to which privileges should be assigned. Defaults to the resource title.
Examples
sudo::group { 'nagios_check_raid':
group => 'nagios',
privileges => [
'ALL = NOPASSWD: /usr/local/lib/nagios/plugins/check-raid'
],
}
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'modules/sudo/manifests/group.pp', line 24
define sudo::group(
Array[String] $privileges = [],
Wmflib::Ensure $ensure = present,
String $group = $title,
) {
require sudo
$title_safe = regsubst($title, '\W', '-', 'G')
$filename = "/etc/sudoers.d/${title_safe}"
if $ensure == 'present' {
file { $filename:
ensure => $ensure,
owner => 'root',
group => 'root',
mode => '0440',
content => template('sudo/sudoers.erb'),
validate_cmd => '/usr/sbin/visudo -cqf %',
}
} else {
file { $filename:
ensure => $ensure,
}
}
}
|