Add optional templating to register_site

Add optional templating for the register site aspect of a pillar.

User can specify keys to be included as defaults, otherwise it is
treated as a normal managed file.
This commit is contained in:
Ryan Peck 2015-03-18 13:36:19 -04:00
parent 77398445a9
commit a83f74c18e
2 changed files with 11 additions and 0 deletions

View File

@ -38,6 +38,13 @@
- user: root
- group: root
- mode: 775
{% if 'template' in pillar['apache']['register-site'][site] and 'defaults' in pillar['apache']['register-site'][site] %}
- template: jinja
- defaults:
{% for key, value in pillar['apache']['register-site'][site]['defaults'].iteritems() %}
{{ key }}: {{ value }}
{% endfor %}
{% endif %}
- watch_in:
- cmd: {{ a2modid }}
- module: apache-reload

View File

@ -81,6 +81,10 @@ apache:
name: 'my name'
path: 'salt://path/to/sites-available/conf/file'
state: 'enabled'
# Optional - use managed file as Jinja Template
#template: true
#defaults:
# custom_var: "default value"
modules:
enabled: # List modules to enable