From 22dcf8ee1c5c81e329adfd9a91fb4a09bbc6c68e Mon Sep 17 00:00:00 2001 From: Alan McNea Date: Mon, 29 Jul 2013 21:31:15 +0000 Subject: [PATCH] Restructured pillar data --- php5.sls | 4 ++-- register_site.sls | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/php5.sls b/php5.sls index 8e974e9..8218818 100644 --- a/php5.sls +++ b/php5.sls @@ -18,10 +18,10 @@ a2enmod php5: - watch_in: - cmd: apache-restart -{% if 'apache-php-ini' in pillar %} +{% if 'apache' in pillar and 'php-ini' in pillar['apache'] %} /etc/php5/apache2/php.ini: file.managed: - - source: {{ pillar['apache-php-ini'] }} + - source: {{ pillar['apache']['php-ini'] }} - order: 225 - watch_in: - cmd: apache-restart diff --git a/register_site.sls b/register_site.sls index 038481b..4857f53 100644 --- a/register_site.sls +++ b/register_site.sls @@ -1,42 +1,42 @@ -{% if 'apache-register-site' in pillar %} #BEGIN: apache-register-site -{% for site in pillar['apache-register-site'] %} +{% if 'apache' in pillar 'register-site' in pillar['apache'] %} #BEGIN: ['apache']['register-site'] +{% for site in pillar['apache']['register-site'] %} #BEGIN: Call apache a2ensite ########################################## -{% if 'name' in pillar['apache-register-site'][site] and 'state' in pillar['apache-register-site'][site] %} +{% if 'name' in pillar['apache']['register-site'][site] and 'state' in pillar['apache']['register-site'][site] %} -{% if pillar['apache-register-site'][site]['state'] == 'enabled' %} -a2ensite {{ pillar['apache-register-site'][site]['name'] }}: +{% if pillar['apache']['register-site'][site]['state'] == 'enabled' %} +a2ensite {{ pillar['apache']['register-site'][site]['name'] }}: {% else %} -a2dissite {{ pillar['apache-register-site'][site]['name'] }}: +a2dissite {{ pillar['apache']['register-site'][site]['name'] }}: {% endif %} cmd.run: -{% if pillar['apache-register-site'][site]['state'] == 'enabled' %} - - unless: ls /etc/apache2/sites-enabled/{{ pillar['apache-register-site'][site]['name'] }} +{% if pillar['apache']['register-site'][site]['state'] == 'enabled' %} + - unless: ls /etc/apache2/sites-enabled/{{ pillar['apache']['register-site'][site]['name'] }} {% else %} - - onlyif: ls /etc/apache2/sites-enabled/{{ pillar['apache-register-site'][site]['name'] }} + - onlyif: ls /etc/apache2/sites-enabled/{{ pillar['apache']['register-site'][site]['name'] }} {% endif %} - order: 230 - require: - pkg: apache - - file: /etc/apache2/sites-available/{{ pillar['apache-register-site'][site]['name'] }} + - file: /etc/apache2/sites-available/{{ pillar['apache']['register-site'][site]['name'] }} {% endif %} ########################################## #BEGIN: Manage apache site config ########################################## -{% if 'name' in pillar['apache-register-site'][site] and 'path' in pillar['apache-register-site'][site] %} +{% if 'name' in pillar['apache']['register-site'][site] and 'path' in pillar['apache']['register-site'][site] %} -/etc/apache2/sites-available/{{ pillar['apache-register-site'][site]['name'] }}: +/etc/apache2/sites-available/{{ pillar['apache']['register-site'][site]['name'] }}: file.managed: - - source: {{ pillar['apache-register-site'][site]['path'] }} + - source: {{ pillar['apache']['register-site'][site]['path'] }} - order: 225 - user: root - group: root - mode: 775 - watch_in: - - cmd: a2ensite {{ pillar['apache-register-site'][site]['name'] }} + - cmd: a2ensite {{ pillar['apache']['register-site'][site]['name'] }} - cmd: apache-reload {% endif %}