From ddf797eba5dac72742348247e539242a906ac672 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 18 Jun 2016 13:07:41 -0300 Subject: Adds apache::site::config --- manifests/site.pp | 48 +++++++----------------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) (limited to 'manifests/site.pp') 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"], } -- cgit v1.2.3