formula-haproxy/haproxy/service.sls
2015-07-23 13:46:56 +10:00

26 lines
579 B
Text

haproxy.service:
{% if salt['pillar.get']('haproxy:enable', True) %}
service.running:
- name: haproxy
- enable: True
- reload: True
- require:
- pkg: haproxy
file: haproxy.service
- watch:
- file: haproxy.config
{% else %}
service.dead:
- name: haproxy
- enable: False
{% endif %}
file.replace:
- name: /etc/default/haproxy
{% if salt['pillar.get']('haproxy:enabled', True) %}
- pattern: ENABLED=0$
- repl: ENABLED=1
{% else %}
- pattern: ENABLED=1$
- repl: ENABLED=0
{% endif %}
- show_changes: True