diff --git a/haproxy/config.sls b/haproxy/config.sls index 37f366f..e8c9865 100644 --- a/haproxy/config.sls +++ b/haproxy/config.sls @@ -14,3 +14,7 @@ haproxy.config: - service: haproxy.service - watch_in: - service: haproxy.service + {% if salt['pillar.get']('haproxy:overwrite', default=True) == False %} + - unless: + - test -e {{ salt['pillar.get']('haproxy:config_file_path', '/etc/haproxy/haproxy.cfg') }} + {% endif %} diff --git a/pillar.example b/pillar.example index e0c9a3f..7d1d408 100644 --- a/pillar.example +++ b/pillar.example @@ -4,6 +4,7 @@ haproxy: enabled: True + overwrite: True # Overwrite an existing config file if present (default behaviour unless set to false) config_file_path: /etc/haproxy/haproxy.cfg global: stats: