diff options
-rw-r--r-- | manifests/init.pp | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 17501ed..50704f2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -139,24 +139,41 @@ class apache { } if $mpm == true and $manage_user == true and $user != 'root' { - if !defined(Group[$gid]) { - group { "$gid": - ensure => $ensure, + if $ensure == present { + if !defined(Group[$gid]) { + group { "$gid": + ensure => present, + } + } + + if !defined(User["$user"]) { + user::manage { "$user": + tag => "virtual", + password => $password, + gid => $gid, + comment => $comment, + ticket => $ticket, + groups => $groups, + sshkey => $sshkey, + shell => $shell, + ensure => present, + require => Group[$gid], + } } } - - if !defined(User["$user"]) { - user::manage { "$user": - tag => "virtual", - password => $password, - gid => $gid, - comment => $comment, - ticket => $ticket, - groups => $groups, - sshkey => $sshkey, - shell => $shell, - ensure => $ensure, - require => Group[$gid], + else { + if !defined(Group[$gid]) { + group { "$gid": + ensure => absent, + require => User[$user], + } + } + + if !defined(User["$user"]) { + user::manage { "$user": + tag => "virtual", + ensure => absent, + } } } } |