apache-formula/apache/vhosts/standard.sls
Cody Hiar 138a522f3f Update standard.sls
Create the vhost DocumentRoot directory if it does not exist
2015-03-23 15:22:08 -06:00

40 lines
1.0 KiB
Plaintext

{% from "apache/map.jinja" import apache with context %}
include:
- apache
{% for id, site in salt['pillar.get']('apache:sites', {}).items() %}
{{ id }}:
file:
- managed
- name: {{ apache.vhostdir }}/{{ id }}{{ apache.confext }}
- source: {{ site.get('template_file', 'salt://apache/vhosts/standard.tmpl') }}
- template: {{ site.get('template_engine', 'jinja') }}
- context:
id: {{ id|json }}
site: {{ site|json }}
map: {{ apache|json }}
- require:
- pkg: apache
- watch_in:
- module: apache-reload
{{ id }}-documentroot:
file.directory:
- unless: test -d {{ site.get('DocumentRoot') }}
- name: {{ site.get('DocumentRoot') }}
{% if grains.os_family == 'Debian' %}
a2ensite {{ id }}{{ apache.confext }}:
cmd:
- run
- unless: test -f /etc/apache2/sites-enabled/{{ id }}{{ apache.confext }}
- require:
- file: /etc/apache2/sites-available/{{ id }}{{ apache.confext }}
- watch_in:
- module: apache-reload
{% endif %}
{% endfor %}