From 0f0d5318e5fa3e0acecbe465f58d4ecb28927679 Mon Sep 17 00:00:00 2001 From: Brad Thurber Date: Tue, 24 Mar 2015 12:48:53 -0400 Subject: [PATCH 1/2] make modules.sls compatible with RHEL/CentOS Apache 2.2 --- apache/modules.sls | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/apache/modules.sls b/apache/modules.sls index 67222e7..6bdcf26 100644 --- a/apache/modules.sls +++ b/apache/modules.sls @@ -26,3 +26,32 @@ a2dismod {{ module }}: {% endfor %} {% endif %} + +{% if grains['os_family']=="RedHat" %} + +include: + - apache + +{% for module in salt['pillar.get']('apache:modules:enabled', []) %} +find /etc/httpd/ -name *.conf -type f -exec sed -i -e 's/\(^#\)\(LoadModule.{{ module }}_module\)/\2/g' {} \;: + cmd.run: + - unless: httpd -M 2> /dev/null | grep {{ module }}_module + - order: 225 + - require: + - pkg: apache + - watch_in: + - module: apache-restart +{% endfor %} + +{% for module in salt['pillar.get']('apache:modules:disabled', []) %} +find /etc/httpd/ -name *.conf -type f -exec sed -i -e 's/\(^LoadModule.{{ module }}_module\)/#\1/g' {} \;: + cmd.run: + - onlyif: httpd -M 2> /dev/null | grep {{ module }}_module + - order: 225 + - require: + - pkg: apache + - watch_in: + - module: apache-restart +{% endfor %} + +{% endif %} From 5afdcb819c69c42246f727636dfa4f13356561b6 Mon Sep 17 00:00:00 2001 From: Brad Thurber Date: Thu, 26 Mar 2015 08:00:11 -0400 Subject: [PATCH 2/2] per @gravyboat suggestion, change separate if to elif --- apache/modules.sls | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apache/modules.sls b/apache/modules.sls index 6bdcf26..5f86993 100644 --- a/apache/modules.sls +++ b/apache/modules.sls @@ -25,9 +25,7 @@ a2dismod {{ module }}: - module: apache-restart {% endfor %} -{% endif %} - -{% if grains['os_family']=="RedHat" %} +{% elif grains['os_family']=="RedHat" %} include: - apache