Defined Type: sudo::user

Defined in:
puppet/modules/sudo/manifests/user.pp

Overview

Define: sudo::user

Provision sudo rights

Parameters

user

User to grant privileges to. Default $title.

privileges

Array of sudoer grants. Default [].

ensure

Whether the file should exist ('present', 'absent'). Default 'present'.

Example

sudo::user { 'mwdeploy' :

privileges => [
    'ALL = (apache,mwdeploy,l10nupdate) NOPASSWD: ALL',
    'ALL = (root) NOPASSWD: /sbin/restart apache2',
    'ALL = (root) NOPASSWD: /sbin/start apache2',
]

}

Parameters:

  • user (Any) (defaults to: $title)
  • privileges (Any) (defaults to: [])
  • ensure (Any) (defaults to: 'present')


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'puppet/modules/sudo/manifests/user.pp', line 26

define sudo::user (
    $user       = $title,
    $privileges = [],
    $ensure     = 'present',
) {

    $grantee = $user
    file { "/etc/sudoers.d/${title}":
        ensure  => $ensure,
        owner   => 'root',
        group   => 'root',
        mode    => '0440',
        content => template('sudo/sudoers.erb'),
    }
}