Skip to content
Snippets Groups Projects
Commit 9490c868 authored by Niels Abspoel's avatar Niels Abspoel
Browse files

use watch module: apache-[restart|reload] consequently

parent 17d3d845
No related branches found
No related tags found
No related merge requests found
Showing
with 178 additions and 7 deletions
......@@ -17,6 +17,10 @@ apache_cert_config_{{ site }}_key_file:
- group: root
- watch_in:
- module: apache-reload
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
{% if confcert.SSLCertificateFile is defined and confcert.SSLCertificateFile_content is defined %}
......@@ -31,6 +35,10 @@ apache_cert_config_{{ site }}_cert_file:
- group: root
- watch_in:
- module: apache-reload
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
{% if confcert.SSLCertificateChainFile is defined and confcert.SSLCertificateChainFile_content is defined %}
......@@ -45,6 +53,10 @@ apache_cert_config_{{ site }}_bundle_file:
- group: root
- watch_in:
- module: apache-reload
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
{%- endfor %}
......
......@@ -9,6 +9,10 @@ include:
- require:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{{ apache.configfile }}:
......@@ -19,6 +23,10 @@ include:
- require:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
- context:
apache: {{ apache }}
......@@ -29,6 +37,10 @@ include:
- require:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% if grains['os_family']=="Debian" %}
......@@ -40,6 +52,10 @@ include:
- require:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{{ apache.portsfile }}:
......@@ -50,6 +66,10 @@ include:
- require:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
- context:
apache: {{ apache }}
......@@ -62,6 +82,10 @@ include:
- require:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
......@@ -74,6 +98,10 @@ include:
- require:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
- context:
apache: {{ apache }}
......@@ -88,6 +116,10 @@ include:
- require:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{{ apache.portsfile }}:
......@@ -98,6 +130,10 @@ include:
- require:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
- context:
apache: {{ apache }}
......
......@@ -24,6 +24,10 @@ a2dissite 000-default{{ apache.confext }}:
- onlyif: test -f /etc/apache2/sites-enabled/000-default{{ apache.confext }}
- watch_in:
- module: apache-reload
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
- require:
- pkg: apache
......
......@@ -3,6 +3,8 @@
apache:
manage_service_states: True
service_state: running
service_enable: True
mod_security:
crs_install: False
......
......@@ -13,6 +13,10 @@ a2enflag {{ flag }}:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endfor %}
{% for module in salt['pillar.get']('apache:flags:disabled', []) %}
......@@ -23,6 +27,10 @@ a2disflag -f {{ flag }}:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endfor %}
{% endif %}
......@@ -12,26 +12,35 @@ apache:
- system: True
{# By default run apache service states (unless pillar is false) #}
{% if salt['pillar.get']('apache:manage_service_states', True) %}
service.running:
service.{{apache.service_state}}:
- name: {{ apache.service }}
{% if apache.service_state in [ 'running', 'dead' ] %}
- enable: True
- require:
- module: apache-restart
- module: apache-reload
{% endif %}
# The following states are inert by default and can be used by other states to
# trigger a restart or reload as needed.
apache-reload:
module.wait:
{% if apache.service_state in ['running'] %}
- name: service.reload
- m_name: {{ apache.service }}
- require:
- module: apache-restart
{% else %}
- name: cmd.run
- cmd: {{apache.custom_reload_command|default('apachectl graceful')}}
- python_shell: True
{% endif %}
apache-restart:
module.wait:
{% if apache.service_state in ['running'] %}
- name: service.restart
- m_name: {{ apache.service }}
{% else %}
- name: cmd.run
- cmd: {{apache.custom_reload_command|default('apachectl graceful')}}
- python_shell: True
{% endif %}
{% else %}
......
......@@ -12,6 +12,10 @@
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{%- endmacro %}
include:
......
......@@ -11,5 +11,9 @@ a2enmod actions:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
......@@ -14,5 +14,9 @@ include:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
......@@ -16,6 +16,10 @@ a2enmod dav_svn:
- pkg: libapache2-mod-svn
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
a2enmod authz_svn:
cmd.run:
......@@ -26,5 +30,9 @@ a2enmod authz_svn:
- pkg: libapache2-mod-svn
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
......@@ -12,6 +12,12 @@ mod-fastcgi:
- require:
- pkgrepo: repo-fastcgi
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
repo-fastcgi:
pkgrepo.managed:
......@@ -28,6 +34,10 @@ a2enmod fastcgi:
- pkg: mod-fastcgi
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
......@@ -20,5 +20,9 @@ a2enmod fcgid for apache.mod_fcgid:
- pkg: mod-fcgid
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
......@@ -12,9 +12,13 @@ mod-geoip:
- {{ apache.mod_geoip_database }}
- require:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% if grains['os_family']=="RedHat" %}
geoip conf:
......
......@@ -11,5 +11,9 @@ a2enmod headers:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
......@@ -13,6 +13,10 @@ a2enmod {{ mpm_module }}:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
file.managed:
- name: /etc/apache2/mods-available/{{ mpm_module }}.conf
- template: jinja
......@@ -22,6 +26,10 @@ a2enmod {{ mpm_module }}:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
# Deactivate the other mpm modules as a previous step
{% for mod in ['mpm_prefork', 'mpm_worker', 'mpm_event'] if not mod == mpm_module %}
......@@ -34,6 +42,10 @@ a2dismod {{ mod }}:
- cmd: a2enmod {{ mpm_module }}
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endfor %}
{% endif %}
......@@ -53,5 +65,9 @@ include:
- pkg: httpd
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
......@@ -17,6 +17,10 @@ a2enmod pagespeed:
- require:
- pkg: libapache2-mod-pagespeed
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% for dir in ['/var/cache/mod_pagespeed', '/var/log/pagespeed'] %}
......
......@@ -9,6 +9,12 @@ mod-perl2:
- order: 180
- require:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% if grains['os_family']=="Debian" %}
a2enmod perl2:
......@@ -19,6 +25,10 @@ a2enmod perl2:
- pkg: mod-perl2
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% elif grains['os_family']=="FreeBSD" %}
......@@ -31,5 +41,9 @@ a2enmod perl2:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
......@@ -19,6 +19,10 @@ a2enmod php5:
- pkg: mod-php5
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% if 'apache' in pillar and 'php-ini' in pillar['apache'] %}
/etc/php5/apache2/php.ini:
......@@ -27,6 +31,10 @@ a2enmod php5:
- order: 225
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
- require:
- pkg: apache
- pkg: mod-php5
......@@ -43,6 +51,10 @@ a2enmod php5:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
......
......@@ -13,6 +13,10 @@ a2enmod mod_proxy:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% elif grains['os_family']=="FreeBSD" %}
{{ apache.modulesdir }}/040_mod_proxy.conf:
......@@ -24,5 +28,9 @@ a2enmod mod_proxy:
- pkg: apache
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
......@@ -13,5 +13,9 @@ a2enmod proxy_fcgi:
- cmd: a2enmod proxy
- watch_in:
- module: apache-restart
- require_in:
- module: apache-restart
- module: apache-reload
- service: apache
{% endif %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment