diff --git a/haproxy/tasks/main.yml b/haproxy/tasks/main.yml index 972429c4..9e6936b5 100644 --- a/haproxy/tasks/main.yml +++ b/haproxy/tasks/main.yml @@ -100,9 +100,11 @@ dest: /etc/haproxy/haproxy.cfg force: "{{ haproxy_force_config }}" validate: "haproxy -c -f %s" - with_first_found: + loop: "{{ query('first_found', templates) }}" + vars: + templates: - "templates/haproxy/haproxy.{{ inventory_hostname }}.cfg.j2" - - "templates/haproxy/haproxy.{{ host_group }}.cfg.j2" + - "templates/haproxy/haproxy.{{ host_group | default('all') }}.cfg.j2" - "templates/haproxy/haproxy.default.cfg.j2" - "haproxy.default.cfg.j2" notify: reload haproxy