Avoid using loop_var in endpoint manage

When the OSA connection plugin is used on older ansible versions,
and when haproxy runs in a container, a bug exists where the loop_var
fails to properly delegate the task to the haproxy container.

We can avoid using loop_var in the delegation of the task by simply
moving the loop_var up one level so that the endpoint-manage task
file can use {{ item }}.

This was introduced in the commit:
a8a8098394 (diff-db999e390dd84f2a8c2a48b19aa9533f)

Fixes-Bug: #1790779
Change-Id: I17dafb283e41ce05083ae4adb3a325aaca0253dd
(cherry picked from commit 63f5d0e4fa)
This commit is contained in:
Logan V 2018-09-18 12:07:57 -05:00
parent d132911b92
commit 83f0bdaeeb
3 changed files with 10 additions and 6 deletions

View File

@ -45,8 +45,10 @@
# the load balancer back end for this container.
- include: ../common-tasks/haproxy-endpoint-manage.yml
vars:
haproxy_backend: "{{ item }}-back"
haproxy_backend: "{{ backend_name }}-back"
haproxy_state: disabled
loop_control:
loop_var: backend_name
when:
- "item in group_names"
- "groups[item] | length > 1"
@ -159,8 +161,10 @@
# to available again.
- include: ../common-tasks/haproxy-endpoint-manage.yml
vars:
haproxy_backend: "{{ item }}-back"
haproxy_backend: "{{ backend_name }}-back"
haproxy_state: enabled
loop_control:
loop_var: backend_name
when:
- "item in group_names"
- "groups[item] | length > 1"

View File

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

View File

@ -74,9 +74,11 @@
# the load balancer back end for this container.
- include: common-tasks/haproxy-endpoint-manage.yml
vars:
haproxy_backend: "{{ item }}"
haproxy_backend: "{{ backend_name }}"
haproxy_state: disabled
when: "groups['keystone_all'] | length > 1"
loop_control:
loop_var: backend_name
with_items:
- "keystone_service-back"
- "keystone_admin-back"