diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2011-03-22 22:40:03 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2011-03-22 22:40:03 -0300 |
commit | 3ad4b14c2d655c34a31a48a5c0e7b1dce06b2c42 (patch) | |
tree | 4229c9d1a55a2e8397e713bbb7f9aa70ca9dacd8 /manifests/init.pp | |
parent | 8c70c95a59b4d5d8ad7f09a76b2495bd7c94fb75 (diff) | |
download | puppet-apache-3ad4b14c2d655c34a31a48a5c0e7b1dce06b2c42.tar.gz puppet-apache-3ad4b14c2d655c34a31a48a5c0e7b1dce06b2c42.tar.bz2 |
Avoiding deletion of user's primary group before deleting the user when ensure is absent
Diffstat (limited to 'manifests/init.pp')
-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, + } } } } |