From 2557d3d1c89397acd05efd0d46f6e98d847c66db Mon Sep 17 00:00:00 2001 From: Rowcliffe Browne Date: Tue, 19 Jan 2016 17:02:31 +0800 Subject: [PATCH] Allow global directives to be added to apache config --- apache/config.sls | 14 ++++++++++++++ apache/files/RedHat/apache-2.2.config.jinja | 4 ++++ apache/files/RedHat/apache-2.4.config.jinja | 4 ++++ apache/files/Suse/global.config.jinja | 4 ++++ pillar.example | 5 +++++ 5 files changed, 31 insertions(+) create mode 100644 apache/files/Suse/global.config.jinja diff --git a/apache/config.sls b/apache/config.sls index b24b62f..0e04e3c 100644 --- a/apache/config.sls +++ b/apache/config.sls @@ -42,3 +42,17 @@ include: - watch_in: - service: apache {% endif %} + +{% if grains['os_family']=="Suse" %} +/etc/apache2/sysconfig.d/global.conf: + file.managed: + - template: jinja + - source: + - salt://apache/files/{{ salt['grains.get']('os_family') }}/global.config.jinja + - require: + - pkg: apache + - watch_in: + - service: apache + - context: + apache: {{ apache }} +{% endif %} diff --git a/apache/files/RedHat/apache-2.2.config.jinja b/apache/files/RedHat/apache-2.2.config.jinja index 24ad38e..c8ab639 100644 --- a/apache/files/RedHat/apache-2.2.config.jinja +++ b/apache/files/RedHat/apache-2.2.config.jinja @@ -416,6 +416,10 @@ AddDefaultCharset UTF-8 #EnableMMAP off EnableSendfile on +{%- for directive, dvalue in salt['pillar.get']('apache:global', {}).items() %} +{{ directive }} {{ dvalue }} +{%- endfor %} + # Supplemental configuration # # Load config files in the "/etc/httpd/conf.d" directory, if any. diff --git a/apache/files/RedHat/apache-2.4.config.jinja b/apache/files/RedHat/apache-2.4.config.jinja index ef067bd..76fc342 100644 --- a/apache/files/RedHat/apache-2.4.config.jinja +++ b/apache/files/RedHat/apache-2.4.config.jinja @@ -350,6 +350,10 @@ AddDefaultCharset UTF-8 #EnableMMAP off EnableSendfile on +{%- for directive, dvalue in salt['pillar.get']('apache:global', {}).items() %} +{{ directive }} {{ dvalue }} +{%- endfor %} + # Supplemental configuration # # Load config files in the "/etc/httpd/conf.d" directory, if any. diff --git a/apache/files/Suse/global.config.jinja b/apache/files/Suse/global.config.jinja new file mode 100644 index 0000000..336f753 --- /dev/null +++ b/apache/files/Suse/global.config.jinja @@ -0,0 +1,4 @@ +{%- for directive, dvalue in salt['pillar.get']('apache:global', {}).items() %} +{{ directive }} {{ dvalue }} +{%- endfor %} + diff --git a/pillar.example b/pillar.example index 03e129e..66fe4ac 100644 --- a/pillar.example +++ b/pillar.example @@ -18,6 +18,11 @@ apache: # ``apache.mod_wsgi`` formula additional configuration: mod_wsgi: mod_wsgi + global: + # global apache directives + AllowEncodedSlashes: "On" + + # ``apache.vhosts`` formula additional configuration: sites: example.net: