diff options
-rw-r--r-- | manifests/init.pp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 8381ed0..14f4ecc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -29,15 +29,14 @@ class apache { ensure => installed, } - package { "mod_macro": - name => "libapache2-mod-macro", - ensure => installed, + service { "apache": + ensure => running, require => Package["apache"], } - service { "apache": - ensure => running, - require => Package["apache", "mod_macro"], + module { "macro": + ensure => present, + require => "libapache2-mod-macro", } # apache mod_macro configuration @@ -47,14 +46,10 @@ class apache { owner => root, group => root, mode => 0644, + require => Module["macro"], notify => Service["apache"], } - module { "macro": - ensure => present, - require => "mod_macro", - } - # prepare variables to use in templates case $apache_sites_folder { '': { $apache_sites_folder = '/var/www/sites' } @@ -73,6 +68,7 @@ class apache { owner => root, group => root, mode => 0644, + require => File["/etc/apache2/conf.d/macros"], notify => Service["apache"], } @@ -101,21 +97,26 @@ class apache { case $ensure { 'present' : { exec { "/usr/sbin/a2enmod $name": - unless => "/bin/sh -c '[ -L ${apache2_mods}-enabled/${name}.load ] \ + unless => "/bin/sh -c '[ -L ${apache2_mods}-enabled/${name}.load ] \ && [ ${apache2_mods}-enabled/${name}.load -ef ${apache2_mods}-available/${name}.load ]'", - notify => Exec["force-reload-apache2"], - require => Package[$require], + notify => Exec["force-reload-apache2"], + require => Package[$require], } } 'absent': { exec { "/usr/sbin/a2dismod $name": - onlyif => "/bin/sh -c '[ -L ${apache2_mods}-enabled/${name}.load ] \ + onlyif => "/bin/sh -c '[ -L ${apache2_mods}-enabled/${name}.load ] \ && [ ${apache2_mods}-enabled/${name}.load -ef ${apache2_mods}-available/${name}.load ]'", - notify => Exec["force-reload-apache2"], - require => Package["apache2"], + notify => Exec["force-reload-apache2"], + require => Package["apache2"], } } default: { err ( "Unknown ensure value: '$ensure'" ) } } } + + exec { "force-reload-apache2": + command => "/etc/init.d/apache2 force-reload", + refreshonly => true, + } } |