Execution
Date 14 Dec 2025 10:21:40 +0000
Duration 00:43:55.98
Controller aio1.openstack.local
User root
Versions
Ansible 2.18.6
ara 1.7.4 / 1.7.4
Python 3.13.5
Summary
13 Hosts
2438 Tasks
2413 Results
107 Plays
511 Files
0 Records

File: /etc/ansible/ansible_collections/openstack/osa/playbooks/haproxy_service_config.yml

---
# Copyright 2023, Cleura AB
#
# 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.

# Haproxy service configs are stored in service group vars
# (for ex. `glance_haproxy_services` are stored in glance group vars).
# This is because they may refer to other variables in this group that are not
# used only for haproxy(like `glance_backend_ssl`).
# Group haproxy_all does not have access to service group vars by default.
# To solve this, haproxy_all hosts are temporarily added to `service_group`.
# After haproxy is configured, refresh_inventory is triggered to restore the
# original inventory state.

- hosts: haproxy
  serial: "{{ haproxy_serial | default('50%') }}"
  tasks:
    - name: Configure haproxy for the service
      ansible.builtin.import_role:
        name: haproxy_server
        tasks_from: haproxy_service_config_external.yml
      vars:
        _service_configs: "{{ groups[service_group] | map('extract', hostvars, service_variable) | flatten | unique }}"
        _unlimited_configs: "{{ _service_configs | rejectattr('haproxy_limit_hosts', 'defined') }}"
        _filtered_configs: >-
          {{ _service_configs | selectattr('haproxy_limit_hosts', 'defined') | selectattr('haproxy_limit_hosts', 'search', inventory_hostname) }}
        haproxy_service_configs: "{{ (_unlimited_configs + _filtered_configs) }}"