From df5edcd8a2a51aba12374ca8cd126fa8952153f1 Mon Sep 17 00:00:00 2001 From: Philipp Marmet Date: Wed, 18 May 2016 13:01:05 +0200 Subject: [PATCH 1/2] Proper disabling of the default vhost Removing the file /etc/apache2/sites-available/000-default.conf leads to an error when Apache is restarted. So the symlink in /etc/apache2/sites-enabled/ should be removed, the actual file can stay. --- apache/no_default_vhost.sls | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apache/no_default_vhost.sls b/apache/no_default_vhost.sls index ff52061..19bd1a8 100644 --- a/apache/no_default_vhost.sls +++ b/apache/no_default_vhost.sls @@ -5,12 +5,13 @@ include: - apache -apache_no-default-vhost: - file.absent: - - name: {{ apache.vhostdir }}/000-default.conf +a2dissite 000-default.conf: + cmd: + - run + - unless: test ! -f /etc/apache2/sites-enabled/000-default.conf - require: - pkg: apache - watch_in: - module: apache-reload -{% endif %} \ No newline at end of file +{% endif %} From 01c9ca4a56954feb9a6cbeb225158da3eb35bef8 Mon Sep 17 00:00:00 2001 From: Philipp Marmet Date: Wed, 18 May 2016 17:04:41 +0200 Subject: [PATCH 2/2] use default style for cmd.run: instead of cmd: - run --- apache/no_default_vhost.sls | 3 +-- apache/vhosts/standard.sls | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/apache/no_default_vhost.sls b/apache/no_default_vhost.sls index 19bd1a8..f316b9e 100644 --- a/apache/no_default_vhost.sls +++ b/apache/no_default_vhost.sls @@ -6,8 +6,7 @@ include: - apache a2dissite 000-default.conf: - cmd: - - run + cmd.run: - unless: test ! -f /etc/apache2/sites-enabled/000-default.conf - require: - pkg: apache diff --git a/apache/vhosts/standard.sls b/apache/vhosts/standard.sls index ccfc736..f0db05d 100644 --- a/apache/vhosts/standard.sls +++ b/apache/vhosts/standard.sls @@ -34,8 +34,7 @@ include: {% if grains.os_family == 'Debian' %} {% if site.get('enabled', True) %} a2ensite {{ id }}{{ apache.confext }}: - cmd: - - run + cmd.run: - unless: test -f /etc/apache2/sites-enabled/{{ id }}{{ apache.confext }} - require: - file: /etc/apache2/sites-available/{{ id }}{{ apache.confext }} @@ -43,8 +42,7 @@ a2ensite {{ id }}{{ apache.confext }}: - module: apache-reload {% else %} a2dissite {{ id }}{{ apache.confext }}: - cmd: - - run + cmd.run: - onlyif: test -f /etc/apache2/sites-enabled/{{ id }}{{ apache.confext }} - require: - file: /etc/apache2/sites-available/{{ id }}{{ apache.confext }}