Add ability to specify modules in pillar

This commit is contained in:
Skyler Berg 2014-11-20 15:37:14 -08:00
parent 82c120586a
commit 11d66cfda7
3 changed files with 40 additions and 0 deletions

View File

@ -20,6 +20,11 @@ Available states
Installs the Apache package and starts the service.
``apache.modules``
------------------
Enables and disables Apache modules.
``apache.mod_proxy``
-------------------

28
apache/modules.sls Normal file
View File

@ -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 %}

View File

@ -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