浏览代码

Merge pull request #56 from thornycrackers/master

Create defaul vhost directories when DocumentRoot is not set
master
Niels Abspoel 9 年前
父节点
当前提交
f6a0c84544
共有 2 个文件被更改,包括 4 次插入5 次删除
  1. +1
    -1
      README.rst
  2. +3
    -4
      apache/vhosts/standard.sls

+ 1
- 1
README.rst 查看文件

@@ -43,7 +43,7 @@ Installs the mod_wsgi package and enables the Apache module.
``apache.vhosts.standard``
-------------------------

Configures Apache name-based virtual hosts using data from Pillar.
Configures Apache name-based virtual hosts and creates virtual host directories using data from Pillar.

Example Pillar:


+ 3
- 4
apache/vhosts/standard.sls 查看文件

@@ -4,6 +4,7 @@ include:
- apache

{% for id, site in salt['pillar.get']('apache:sites', {}).items() %}
{% set documentroot = site.get('DocumentRoot', '{0}/{1}'.format(apache.wwwdir, sitename)) %}

{{ id }}:
file:
@@ -20,13 +21,11 @@ include:
- watch_in:
- module: apache-reload

{% if 'DocumentRoot' in site %}
{{ id }}-documentroot:
file.directory:
- unless: test -d {{ site.get('DocumentRoot') }}
- name: {{ site.get('DocumentRoot') }}
- unless: test -d {{ documentroot }}
- name: {{ documentroot }}
- makedirs: True
{% endif %}

{% if grains.os_family == 'Debian' %}
a2ensite {{ id }}{{ apache.confext }}:

正在加载...
取消
保存