diff --git a/README.rst b/README.rst index 7b1b56f..f44ee42 100644 --- a/README.rst +++ b/README.rst @@ -20,6 +20,11 @@ Available states Installs the Apache package and starts the service. +``apache.modules`` +------------------ + +Enables and disables Apache modules. + ``apache.mod_proxy`` ------------------- diff --git a/apache/modules.sls b/apache/modules.sls new file mode 100644 index 0000000..67222e7 --- /dev/null +++ b/apache/modules.sls @@ -0,0 +1,28 @@ +{% if grains['os_family']=="Debian" %} + +include: + - apache + +{% for module in salt['pillar.get']('apache:modules:enabled', []) %} +a2enmod {{ module }}: + cmd.run: + - unless: ls /etc/apache2/mods-enabled/{{ module }}.load + - order: 225 + - require: + - pkg: apache + - watch_in: + - module: apache-restart +{% endfor %} + +{% for module in salt['pillar.get']('apache:modules:disabled', []) %} +a2dismod {{ module }}: + cmd.run: + - onlyif: ls /etc/apache2/mods-enabled/{{ module }}.load + - order: 225 + - require: + - pkg: apache + - watch_in: + - module: apache-restart +{% endfor %} + +{% endif %} diff --git a/pillar.example b/pillar.example index 4745562..03a463a 100644 --- a/pillar.example +++ b/pillar.example @@ -68,3 +68,10 @@ apache: name: 'my name' path: 'salt://path/to/sites-available/conf/file' state: 'enabled' + + modules: + enabled: # List modules to enable + - ldap + - ssl + disabled: # List modules to disable + - rewrite