summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-06-18 13:41:19 -0300
committerSilvio Rhatto <rhatto@riseup.net>2016-06-18 13:41:19 -0300
commitcf6b8e9eac809bca6e558131a56ba55accb3b46c (patch)
tree0f72f0671b1229d7f1ecb2778d18ed7764354e6c /manifests
parentd5be34ca78f3330c4eb04ab59bc236641c392b94 (diff)
downloadpuppet-apache-cf6b8e9eac809bca6e558131a56ba55accb3b46c.tar.gz
puppet-apache-cf6b8e9eac809bca6e558131a56ba55accb3b46c.tar.bz2
Adds apache::site::user
Diffstat (limited to 'manifests')
-rw-r--r--manifests/site.pp54
-rw-r--r--manifests/site/user.pp56
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],
+ }
+ }
+ }
+ }
+}