diff --git a/states/haproxy/defaults.yaml b/states/haproxy/defaults.yaml index 4afc712..5934d55 100644 --- a/states/haproxy/defaults.yaml +++ b/states/haproxy/defaults.yaml @@ -8,6 +8,7 @@ haproxy: - domains - redirects - vhosts + acme: false config: dir: /etc/haproxy configfile: haproxy.cfg diff --git a/states/haproxy/init.sls b/states/haproxy/init.sls index 92ebfdb..5adcc1d 100644 --- a/states/haproxy/init.sls +++ b/states/haproxy/init.sls @@ -1,6 +1,9 @@ --- +{%- from "haproxy/map.jinja" import haproxy with context %} include: +{%- if haproxy.acme %} - acme +{%- endif %} - .install - .config - - .service \ No newline at end of file + - .service diff --git a/states/haproxy/map.jinja b/states/haproxy/map.jinja index 75eef84..6fc2b02 100644 --- a/states/haproxy/map.jinja +++ b/states/haproxy/map.jinja @@ -1,14 +1,16 @@ {%- import_yaml "haproxy/defaults.yaml" as defaults -%} -{%- set haproxy = salt['pillar.get']('haproxy', default=defaults.haproxy, merge=True) -%} +{%- set haproxy = salt['pillar.get']('haproxy', + default=defaults.haproxy, + merge=True) -%} {%- set users = salt['pillar.get']('htpasswds') -%} {%- set net = salt['pillar.get']('net') -%} {% set peers = salt['mine.get']( - tgt='G@lb:true', - fun='internal_ip_addrs', - tgt_type='compound') %} + tgt='G@lb:true', + fun='internal_ip_addrs', + tgt_type='compound') %} {% set peers_ip = [] %} {%- for k,v in peers.items() %}