瀏覽代碼

add an 'enabled' attribute for a site in pillar

tags/v0.37.4
Mathieu Tarral 9 年之前
父節點
當前提交
c195dce07c
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. +9
    -0
      apache/vhosts/standard.sls
  2. +1
    -0
      pillar.example

+ 9
- 0
apache/vhosts/standard.sls 查看文件

@@ -28,6 +28,7 @@ include:
- makedirs: True

{% if grains.os_family == 'Debian' %}
{% if site.get('enabled') %}
a2ensite {{ id }}{{ apache.confext }}:
cmd:
- run
@@ -36,6 +37,14 @@ a2ensite {{ id }}{{ apache.confext }}:
- file: /etc/apache2/sites-available/{{ id }}{{ apache.confext }}
- watch_in:
- module: apache-reload
{% else %}
a2dissite {{ id }}{{ apache.confext }}:
cmd:
- run
- require:
- file: /etc/apache2/sites-available/{{ id }}{{ apache.confext }}
- watch_in:
- module: apache-reload
{% endif %}

{% endfor %}

+ 1
- 0
pillar.example 查看文件

@@ -18,6 +18,7 @@ apache:
template_file: salt://apache/vhosts/minimal.tmpl

example.com: # must be unique; used as an ID declaration in Salt.
enabled: True
template_file: salt://apache/vhosts/standard.tmpl # or redirect.tmpl or proxy.tmpl

####################### DEFAULT VALUES BELOW ############################

Loading…
取消
儲存