diff options
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"], + #} +} |