Defined Type: pam::service
- Defined in:
- manifests/service.pp
Summary
Manage PAM file for specific service. The `pam::service` resource isOverview
reversible, so that any service that Puppet has locked using PAM can be unlocked by setting the resource ensure to absent and waiting for the next puppet run.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'manifests/service.pp', line 28
define pam::service (
Enum['present', 'absent'] $ensure = 'present',
Stdlib::Absolutepath $pam_config_dir = '/etc/pam.d',
Optional[String] $content = undef,
Optional[Array] $lines = undef
) {
include pam
case $ensure {
'present': {
$file_ensure = 'file'
}
default: {
$file_ensure = 'absent'
}
}
if $content and $lines {
fail('pam::service expects one of the lines or contents parameters to be provided, but not both')
} elsif $content {
$my_content = $content
} elsif $lines {
$my_content = template('pam/service.erb')
} else {
$my_content = undef
}
file { "pam.d-service-${name}":
ensure => $file_ensure,
path => "${pam_config_dir}/${name}",
content => $my_content,
owner => 'root',
group => 'root',
mode => '0644',
}
}
|