From 5b98ce89011527c5430138ebfc7f1d23aa341b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20Moso=C5=84?= Date: Fri, 13 Nov 2015 16:49:53 +0100 Subject: [PATCH] /etc/default/haproxy exists only on Debian-based distros 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: ``` --- haproxy/service.sls | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/haproxy/service.sls b/haproxy/service.sls index 7e16794..21c8434 100644 --- a/haproxy/service.sls +++ b/haproxy/service.sls @@ -6,12 +6,15 @@ haproxy.service: - reload: True - require: - pkg: haproxy - file: haproxy.service +{% 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) %} @@ -22,3 +25,4 @@ haproxy.service: - repl: ENABLED=0 {% endif %} - show_changes: True +{% endif %}