5b98ce8901
Currently it's not possible to do `haproxy.service` on RedHat-based distros (like CentOS). Initscript doesn't use this file at all, so it's not needed to create it anyway. Actual result: ```---------- ID: haproxy.service Function: file.replace Name: /etc/default/haproxy Result: False Comment: /etc/default/haproxy: file not found Started: 16:16:46.775448 Duration: 2.19 ms Changes: ```
28 lines
667 B
Text
28 lines
667 B
Text
haproxy.service:
|
|
{% if salt['pillar.get']('haproxy:enable', True) %}
|
|
service.running:
|
|
- name: haproxy
|
|
- enable: True
|
|
- reload: True
|
|
- require:
|
|
- pkg: haproxy
|
|
{% if salt['grains.get']('os_family') == 'Debian' %}
|
|
- file: haproxy.service
|
|
{% endif %}
|
|
{% else %}
|
|
service.dead:
|
|
- name: haproxy
|
|
- 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 %}
|