summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-03-22 22:40:03 -0300
committerSilvio Rhatto <rhatto@riseup.net>2011-03-22 22:40:03 -0300
commit3ad4b14c2d655c34a31a48a5c0e7b1dce06b2c42 (patch)
tree4229c9d1a55a2e8397e713bbb7f9aa70ca9dacd8
parent8c70c95a59b4d5d8ad7f09a76b2495bd7c94fb75 (diff)
downloadpuppet-apache-3ad4b14c2d655c34a31a48a5c0e7b1dce06b2c42.tar.gz
puppet-apache-3ad4b14c2d655c34a31a48a5c0e7b1dce06b2c42.tar.bz2
Avoiding deletion of user's primary group before deleting the user when ensure is absent
-rw-r--r--manifests/init.pp49
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,
+ }
}
}
}