Skip to content

Instantly share code, notes, and snippets.

@raphink
Created May 6, 2019 07:17
Show Gist options
  • Save raphink/6bdf7badca949d4b45d91a95b36ba483 to your computer and use it in GitHub Desktop.
Save raphink/6bdf7badca949d4b45d91a95b36ba483 to your computer and use it in GitHub Desktop.
define user_group (
String $group,
Enum['present', 'absent'] $ensure = 'present',
) {
$changes = $ensure ? {
'present' => "defnode ${group}/user[.='${name}'] '${name}'",
'absent' => "rm ${group}/user[.='${name}']",
}
augeas { "Manage ${title} in group ${group}":
lens => 'Group.lns',
incl => '/etc/group',
changes => $changes,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment