From a8a809839484105d9cd27463defc19a8a617c64b Mon Sep 17 00:00:00 2001 From: Gaudenz Steinlin Date: Tue, 5 Jun 2018 16:41:12 +0200 Subject: [PATCH] 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 (cherry picked from commit 144b8505636f7065519c6c905d0b184367396d82) --- playbooks/common-tasks/haproxy-endpoint-manage.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/playbooks/common-tasks/haproxy-endpoint-manage.yml b/playbooks/common-tasks/haproxy-endpoint-manage.yml index 95143a7536..4db628cd9f 100644 --- a/playbooks/common-tasks/haproxy-endpoint-manage.yml +++ b/playbooks/common-tasks/haproxy-endpoint-manage.yml @@ -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