Fix loop variable name for nested loop

The HAProxy service management did not work because the loop variable
"item" was used in a nested loop within an include. Because of this the
haproxy Ansible module acted on an inexistant HAProxy backend.
Unfortunately the module does not throw an error in this case.

The issue is fixed by using loop_control/loop_var in the inner loop to
use another loop variable name.

Change-Id: Ia9d23f8861b53eadd7d4eff4a68683ebcda37dc2
This commit is contained in:
Gaudenz Steinlin 2018-06-05 16:41:12 +02:00
parent 899bc74a67
commit 144b850563

View File

@ -24,7 +24,9 @@
wait_interval: "{{ haproxy_wait_interval | default(5) }}" wait_interval: "{{ haproxy_wait_interval | default(5) }}"
wait_retries: "{{ haproxy_wait_retries | default(24) }}" wait_retries: "{{ haproxy_wait_retries | default(24) }}"
weight: "{{ haproxy_weight | default(omit) }}" weight: "{{ haproxy_weight | default(omit) }}"
delegate_to: "{{ item }}" delegate_to: "{{ delegate_host }}"
with_items: "{{ groups['haproxy'] }}" with_items: "{{ groups['haproxy'] }}"
loop_control:
loop_var: delegate_host
tags: tags:
- common-haproxy - common-haproxy