2017-10-31 09:09:52 -04:00
|
|
|
{% from "haproxy/map.jinja" import haproxy with context %}
|
|
|
|
|
2015-02-24 16:19:02 -05:00
|
|
|
haproxy.service:
|
2015-07-13 05:17:26 -04:00
|
|
|
{% if salt['pillar.get']('haproxy:enable', True) %}
|
2015-02-24 16:19:02 -05:00
|
|
|
service.running:
|
2017-10-31 09:09:52 -04:00
|
|
|
- name: {{ haproxy.service }}
|
2015-02-24 16:19:02 -05:00
|
|
|
- enable: True
|
2015-03-17 12:35:21 -04:00
|
|
|
- reload: True
|
2015-02-24 16:19:02 -05:00
|
|
|
- require:
|
2018-03-22 20:43:25 -04:00
|
|
|
- pkg: haproxy.install
|
2015-11-13 10:49:53 -05:00
|
|
|
{% if salt['grains.get']('os_family') == 'Debian' %}
|
|
|
|
- file: haproxy.service
|
|
|
|
{% endif %}
|
2015-07-13 05:17:26 -04:00
|
|
|
{% else %}
|
|
|
|
service.dead:
|
2018-03-22 20:43:25 -04:00
|
|
|
- name: {{ haproxy.service }}
|
2015-07-13 05:17:26 -04:00
|
|
|
- enable: False
|
|
|
|
{% endif %}
|
2015-11-13 10:49:53 -05:00
|
|
|
{% if salt['grains.get']('os_family') == 'Debian' %}
|
2015-07-13 05:14:51 -04:00
|
|
|
file.replace:
|
2015-02-24 16:19:02 -05:00
|
|
|
- name: /etc/default/haproxy
|
2015-07-13 05:14:51 -04:00
|
|
|
{% if salt['pillar.get']('haproxy:enabled', True) %}
|
|
|
|
- pattern: ENABLED=0$
|
|
|
|
- repl: ENABLED=1
|
|
|
|
{% else %}
|
|
|
|
- pattern: ENABLED=1$
|
|
|
|
- repl: ENABLED=0
|
|
|
|
{% endif %}
|
|
|
|
- show_changes: True
|
2015-11-13 10:49:53 -05:00
|
|
|
{% endif %}
|