diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2016-06-18 13:41:19 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2016-06-18 13:41:19 -0300 |
commit | cf6b8e9eac809bca6e558131a56ba55accb3b46c (patch) | |
tree | 0f72f0671b1229d7f1ecb2778d18ed7764354e6c /manifests | |
parent | d5be34ca78f3330c4eb04ab59bc236641c392b94 (diff) | |
download | puppet-apache-cf6b8e9eac809bca6e558131a56ba55accb3b46c.tar.gz puppet-apache-cf6b8e9eac809bca6e558131a56ba55accb3b46c.tar.bz2 |
Adds apache::site::user
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/site.pp | 54 | ||||
-rw-r--r-- | manifests/site/user.pp | 56 |
2 files changed, 69 insertions, 41 deletions
diff --git a/manifests/site.pp b/manifests/site.pp index 2c76a01..6af019e 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -35,7 +35,6 @@ define apache::site( $hosting_domain = hiera('apache::site::domain', $::domain) ) { - $vhost = $filename ? { '' => "${name}", default => "$filename", @@ -61,46 +60,19 @@ define apache::site( } } - if $mpm == true and $manage_user == true and $user != 'root' { - 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, - sshkey_options => $sshkey_options, - shell => $shell, - ensure => present, - require => Group[$gid], - } - } - } - else { - if !defined(User["$user"]) { - user::manage { "$user": - tag => "virtual", - password => $password, - ensure => absent, - } - } - - if !defined(Group[$gid]) { - group { "$gid": - ensure => absent, - require => User[$user], - } - } - } + apache::site::user { $name: + ensure => $ensure, + mpm => $mpm, + manage_user => $manage_user, + user => $user, + password => $password, + gid => $gid, + comment => $comment, + ticket => $ticket, + groups => $groups, + sshkey => $sshkey, + sshkey_options => $sshkey_options, + shell => $shell, } if $ssl == true { diff --git a/manifests/site/user.pp b/manifests/site/user.pp new file mode 100644 index 0000000..ec5866c --- /dev/null +++ b/manifests/site/user.pp @@ -0,0 +1,56 @@ +define apache::site::user( + $ensure = present, + $mpm = true, + $manage_user = true, + $user = $name, + $gid = $name, + $ticket = false, + $password = '*', + $comment = '', + $sshkey = absent, + $sshkey_options = [], + $groups = '', + $shell = '/bin/false', +){ + if $mpm == true and $manage_user == true and $user != 'root' { + 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, + sshkey_options => $sshkey_options, + shell => $shell, + ensure => present, + require => Group[$gid], + } + } + } + else { + if !defined(User["$user"]) { + user::manage { "$user": + tag => "virtual", + password => $password, + ensure => absent, + } + } + + if !defined(Group[$gid]) { + group { "$gid": + ensure => absent, + require => User[$user], + } + } + } + } +} |