formula-haproxy/haproxy/service.sls
Mathieu Masse dafe8fd6a5 Fix service state when override are used
Service.running now uses correct require pkg id if
haproxy.lookup.package is used
Service.dead now uses correct name when haproxy.lookup.service is used
2018-03-22 20:43:25 -04:00

31 lines
763 B
Plaintext

{% from "haproxy/map.jinja" import haproxy with context %}
haproxy.service:
{% if salt['pillar.get']('haproxy:enable', True) %}
service.running:
- name: {{ haproxy.service }}
- enable: True
- reload: True
- require:
- pkg: haproxy.install
{% if salt['grains.get']('os_family') == 'Debian' %}
- file: haproxy.service
{% endif %}
{% else %}
service.dead:
- name: {{ haproxy.service }}
- enable: False
{% endif %}
{% if salt['grains.get']('os_family') == 'Debian' %}
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
{% endif %}