Add loadbalancer-config role and wrap haproxy-config role inside

This patch adds loadbalancer-config role
which is "wrapper" around haproxy-config
and proxysql-config role which will be added
in follow-up patches.

Change-Id: I64d41507317081e1860a94b9481a85c8d400797d
This commit is contained in:
Michal Arbet 2022-07-26 10:44:28 +02:00
parent baad47ac61
commit 4838591c6c
50 changed files with 99 additions and 103 deletions

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ aodh_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ barbican_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ blazar_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
role: haproxy-config
role: loadbalancer-config
vars:
project_services: "{{ ceph_rgw_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ cinder_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ cloudkitty_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ cyborg_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ designate_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ elasticsearch_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ freezer_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ glance_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ gnocchi_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ grafana_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ heat_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ horizon_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ influxdb_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ ironic_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ keystone_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ kibana_services }}"
tags: always

View File

@ -0,0 +1,2 @@
---
haproxy_config_install: "{{ project_name != 'mariadb' or not enable_proxysql | bool }}"

View File

@ -0,0 +1,4 @@
---
- import_role:
name: haproxy-config
when: haproxy_config_install | bool

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ magnum_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ manila_services }}"
tags: always

View File

@ -38,19 +38,9 @@
failed_when: False
run_once: True
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ mariadb_services }}"
tags: always
when: not enable_proxysql | bool
- name: "Configure proxysql for {{ project_name }}"
import_role:
name: proxysql-config
vars:
project: "mariadb"
project_database_shard: "{{ mariadb_shards_info }}"
tags: always
when: enable_proxysql | bool

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ masakari_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ memcached_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ mistral_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ monasca_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ murano_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ neutron_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
# Configure HAProxy for one cell for a particular console proxy type.
- import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ cell_proxy_project_services | namespace_haproxy_for_cell(cell_name) }}"
# Default is necessary because this play may not be targetting the hosts in

View File

@ -9,7 +9,7 @@
# group membership as a guide. We'll take novncproxy as an example. We find the
# set of unique values of the 'nova_cell_novncproxy_group' variable for hosts
# in the global 'nova-novncproxy' group - there should be one for each cell.
# Then for each of those groups, we run the haproxy-config role, using the
# Then for each of those groups, we run the loadbalancer-config role, using the
# proxy configuration for a host in that group. This allows us to have
# different ports for each cell, and potentially a different console type
# (nova_console) also.

View File

@ -2,14 +2,14 @@
# Configure HAProxy for all cells for a particular proxy type.
# Iterate over each cell group, creating HAProxy config for that cell.
- name: "Configure HAProxy for {{ cell_proxy_service_name }}"
- name: "Configure loadbalancer for {{ cell_proxy_service_name }}"
include_tasks: cell_proxy_loadbalancer.yml
vars:
# NOTE(mgoddard): Defining this here rather than in
# cell_proxy_loadbalancer.yml due to a weird issue seen on Ansible 2.8. If
# project_name is specified as a role variable for the import, it seems to
# get stuck and override the variable for subsequent imports of the
# haproxy-config role for other services. By that point
# loadbalancer-config role for other services. By that point
# cell_proxy_service_name is no longer defined, so it fails.
project_name: "nova-cell:{{ cell_proxy_service_name }}"
with_items: "{{ cell_proxy_groups }}"

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ nova_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ octavia_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ placement_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ prometheus_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ rabbitmq_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ sahara_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ senlin_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ skydive_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ solum_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ swift_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ tacker_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ trove_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ venus_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ vitrage_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ watcher_services }}"
tags: always

View File

@ -1,7 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: haproxy-config
name: loadbalancer-config
vars:
project_services: "{{ zun_services }}"
tags: always

View File

@ -71,7 +71,7 @@ def namespace_haproxy_for_cell(services, cell_name):
# name.
return "{}_{}".format(name, cell_name) if cell_name else name
# Service name must be namespaced as haproxy-config uses this as the
# Service name must be namespaced as loadbalancer-config uses this as the
# config file name.
services = {
_namespace(service_name): service