Skip to content

Commit

Permalink
Fix loop variable name for nested loop
Browse files Browse the repository at this point in the history
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
(cherry picked from commit 144b850)
  • Loading branch information
gaudenz authored and Jesse Pretorius (odyssey4me) committed Jul 2, 2018
1 parent af74861 commit a8a8098
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion playbooks/common-tasks/haproxy-endpoint-manage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
wait_interval: "{{ haproxy_wait_interval | default(5) }}"
wait_retries: "{{ haproxy_wait_retries | default(24) }}"
weight: "{{ haproxy_weight | default(omit) }}"
delegate_to: "{{ item }}"
delegate_to: "{{ delegate_host }}"
with_items: "{{ groups['haproxy'] }}"
loop_control:
loop_var: delegate_host
tags:
- common-haproxy

0 comments on commit a8a8098

Please sign in to comment.