openstack-ansible/playbooks/common-tasks/haproxy-endpoint-manage.yml
Gaudenz Steinlin 144b850563 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
2018-06-07 17:06:35 +02:00

33 lines
1.3 KiB
YAML

---
# Copyright 2017, Logan Vig <logan2211@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Set haproxy service state
haproxy:
socket: /var/run/haproxy.stat
backend: "{{ haproxy_backend | default(omit) }}"
host: "{{ inventory_hostname }}"
state: "{{ haproxy_state | default('enabled') }}"
shutdown_sessions: "{{ haproxy_shutdown_sessions | default(False) | bool }}"
wait: "{{ haproxy_wait | default(False) | bool }}"
wait_interval: "{{ haproxy_wait_interval | default(5) }}"
wait_retries: "{{ haproxy_wait_retries | default(24) }}"
weight: "{{ haproxy_weight | default(omit) }}"
delegate_to: "{{ delegate_host }}"
with_items: "{{ groups['haproxy'] }}"
loop_control:
loop_var: delegate_host
tags:
- common-haproxy