diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2016-06-18 13:07:41 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2016-06-18 13:07:41 -0300 |
commit | ddf797eba5dac72742348247e539242a906ac672 (patch) | |
tree | 34ed9418111ec517f5b24e3b3e11bca14d3a4b0d /manifests | |
parent | 6b40dc405a167461fe39667d68772161980850cf (diff) | |
download | puppet-apache-ddf797eba5dac72742348247e539242a906ac672.tar.gz puppet-apache-ddf797eba5dac72742348247e539242a906ac672.tar.bz2 |
Adds apache::site::config
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/site.pp | 48 | ||||
-rw-r--r-- | manifests/site/config.pp | 47 |
2 files changed, 54 insertions, 41 deletions
diff --git a/manifests/site.pp b/manifests/site.pp index 8bb878c..ccde244 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -122,47 +122,13 @@ define apache::site( ensure => absent, } - case $source { - true: { - file { "${apache::conf_sites}-available/$vhost.conf": - ensure => $ensure, - source => [ "puppet:///modules/site_apache/vhosts/$domain/${name}", - "puppet:///modules/site_apache/vhosts/${name}" ], - owner => root, - group => root, - mode => 0644, - require => File["${apache::macros}"], - notify => Service["apache"], - } - } - false: { - file { "${apache::conf_sites}-available/$vhost.conf": - ensure => $ensure, - content => template("$template"), - owner => root, - group => root, - mode => 0644, - require => File["${apache::macros}"], - notify => Service["apache"], - } - } + apache::site::config { $name: + ensure => $ensure, + source => $source, + vhost => $vhost, + template => $template, } - # Enable the site without a2ensite - # - #$status = $ensure ? { - # 'present' => "${apache::conf_sites}-available/$vhost.conf", - # default => 'absent', - #} - # - #file { "/etc/apache2/sites-enabled/$vhost.conf": - # ensure => $status, - # owner => root, - # group => root, - # require => File["${apache::conf_sites}-available/${name}"], - # notify => Service["apache"], - #} - case $ensure { 'present': { if ($docroot != false) and ($manage_docroot == true) { @@ -192,7 +158,7 @@ define apache::site( }, unless => "/bin/sh -c '[ -L ${apache::conf_sites}-enabled/$vhost.conf ] \ && [ ${apache::conf_sites}-enabled/$vhost.conf -ef ${apache::conf_sites}-available/$vhost.conf ]'", - require => File["${apache::conf_sites}-available/$vhost.conf"], + require => Apache::Site::Config[$name], notify => Exec["reload-apache2"], } } @@ -204,7 +170,7 @@ define apache::site( }, onlyif => "/bin/sh -c '[ -L ${apache::conf_sites}-enabled/$vhost.conf ] \ && [ ${apache::conf_sites}-enabled/$vhost.conf -ef ${apache::conf_sites}-available/$vhost.conf ]'", - require => File["${apache::conf_sites}-available/$vhost.conf"], + require => Apache::Site::Config[$name], notify => Exec["reload-apache2"], } diff --git a/manifests/site/config.pp b/manifests/site/config.pp new file mode 100644 index 0000000..e084b46 --- /dev/null +++ b/manifests/site/config.pp @@ -0,0 +1,47 @@ +define apache::site::config( + $ensure = 'present', + $source = false, + $vhost = $name, + $template = 'apache/site.erb', +) { + case $source { + true: { + file { "${apache::conf_sites}-available/$vhost.conf": + ensure => $ensure, + source => [ "puppet:///modules/site_apache/vhosts/${::domain}/${name}", + "puppet:///modules/site_apache/vhosts/${name}" ], + owner => root, + group => root, + mode => 0644, + require => File["${apache::macros}"], + notify => Service["apache"], + } + } + false: { + file { "${apache::conf_sites}-available/$vhost.conf": + ensure => $ensure, + content => template("$template"), + owner => root, + group => root, + mode => 0644, + require => File["${apache::macros}"], + notify => Service["apache"], + } + } + } + + # Enable the site without a2ensite + # + #$status = $ensure ? { + # 'present' => "${apache::conf_sites}-available/$vhost.conf", + # default => 'absent', + #} + # + #file { "/etc/apache2/sites-enabled/$vhost.conf": + # ensure => $status, + # owner => root, + # group => root, + # require => File["${apache::conf_sites}-available/${name}"], + # notify => Service["apache"], + #} +} |