Merge pull request #37 from Martin819/master
Optimize 'noservices' condition
diff --git a/haproxy/proxy.sls b/haproxy/proxy.sls
index d5e65cd..7935c62 100644
--- a/haproxy/proxy.sls
+++ b/haproxy/proxy.sls
@@ -35,18 +35,17 @@
{% endif %}
-{% if not grains.get('noservices', False) %}
-
haproxy_service:
service.running:
- name: {{ proxy.service }}
- enable: true
+ {%- if grains.get('noservices') %}
+ - onlyif: /bin/false
+ {%- endif %}
- watch:
- file: /etc/haproxy/haproxy.cfg
- file: /etc/default/haproxy
-{% endif %}
-
{%- for listen_name, listen in proxy.get('listen', {}).iteritems() %}
{%- if listen.get('enabled', True) %}
{%- for bind in listen.binds %}
@@ -67,10 +66,8 @@
chain: {{ bind.ssl.get('chain', '')|yaml }}
- require:
- file: haproxy_ssl
- {% if not grains.get('noservices', False) %}
- watch_in:
- service: haproxy_service
- {% endif %}
{%- endif %}
{%- endfor %}