From f0241f807fe154f89178b1c853626d5570c0394e Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Fri, 3 Sep 2021 16:41:50 +0200 Subject: [PATCH] Remove haproxy,keepalived groups Haproxy was renamed in [1]. [1] https://review.opendev.org/c/openstack/kolla-ansible/+/770618 Change-Id: Ib2d7f0774fede570a8c4c315d83afd420c31da0b --- ansible/inventory/all-in-one | 10 +- ansible/inventory/multinode | 10 +- ansible/roles/loadbalancer/defaults/main.yml | 4 +- ansible/roles/loadbalancer/tasks/precheck.yml | 112 +++++++++--------- .../prechecks/tasks/inventory_checks.yml | 11 ++ ansible/roles/prechecks/tasks/main.yml | 2 + .../roles/telegraf/templates/telegraf.conf.j2 | 2 +- ansible/site.yml | 2 + .../databases/external-mariadb-guide.rst | 2 +- .../high-availability/haproxy-guide.rst | 2 +- doc/source/user/multinode.rst | 2 +- .../drop-group-haproxy-6119957627811873.yaml | 5 + tests/templates/inventory.j2 | 7 +- 13 files changed, 90 insertions(+), 81 deletions(-) create mode 100644 ansible/roles/prechecks/tasks/inventory_checks.yml create mode 100644 releasenotes/notes/drop-group-haproxy-6119957627811873.yaml diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index ead8ad6f74..ac95fc2ef1 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -29,7 +29,7 @@ storage monitoring [chrony-server:children] -haproxy +loadbalancer [chrony:children] control @@ -78,12 +78,6 @@ compute [loadbalancer:children] network -[keepalived:children] -loadbalancer - -[haproxy:children] -loadbalancer - [mariadb:children] control @@ -697,7 +691,7 @@ storage mariadb [prometheus-haproxy-exporter:children] -haproxy +loadbalancer [prometheus-memcached-exporter:children] memcached diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index 937032f230..045610a818 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -53,7 +53,7 @@ storage monitoring [chrony-server:children] -haproxy +loadbalancer [chrony:children] control @@ -102,12 +102,6 @@ compute [loadbalancer:children] network -[keepalived:children] -loadbalancer - -[haproxy:children] -loadbalancer - [mariadb:children] control @@ -715,7 +709,7 @@ storage mariadb [prometheus-haproxy-exporter:children] -haproxy +loadbalancer [prometheus-memcached-exporter:children] memcached diff --git a/ansible/roles/loadbalancer/defaults/main.yml b/ansible/roles/loadbalancer/defaults/main.yml index ca48da20a4..dd58168d9d 100644 --- a/ansible/roles/loadbalancer/defaults/main.yml +++ b/ansible/roles/loadbalancer/defaults/main.yml @@ -4,7 +4,7 @@ project_name: "loadbalancer" loadbalancer_services: haproxy: container_name: haproxy - group: haproxy + group: loadbalancer enabled: true image: "{{ haproxy_image_full }}" privileged: True @@ -13,7 +13,7 @@ loadbalancer_services: healthcheck: "{{ haproxy_healthcheck }}" keepalived: container_name: keepalived - group: keepalived + group: loadbalancer enabled: "{{ enable_keepalived | bool }}" image: "{{ keepalived_image_full }}" privileged: True diff --git a/ansible/roles/loadbalancer/tasks/precheck.yml b/ansible/roles/loadbalancer/tasks/precheck.yml index 6ccd8bdd6d..10d13d45e1 100644 --- a/ansible/roles/loadbalancer/tasks/precheck.yml +++ b/ansible/roles/loadbalancer/tasks/precheck.yml @@ -19,7 +19,7 @@ changed_when: false when: - enable_keepalived | bool - - inventory_hostname in groups['keepalived'] + - inventory_hostname in groups['loadbalancer'] - name: Group hosts by whether they are running HAProxy group_by: @@ -27,7 +27,7 @@ changed_when: false when: - enable_haproxy | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - name: Set facts about whether we can run HAProxy and keepalived VIP prechecks vars: @@ -116,7 +116,7 @@ when: - enable_haproxy | bool - container_facts['haproxy'] is not defined - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - name: Checking free port for HAProxy monitor (api interface) wait_for: @@ -128,7 +128,7 @@ when: - enable_haproxy | bool - container_facts['haproxy'] is not defined - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - name: Checking free port for HAProxy monitor (vip interface) wait_for: @@ -140,7 +140,7 @@ when: - enable_haproxy | bool - haproxy_vip_prechecks - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - api_interface_address != kolla_internal_vip_address # FIXME(yoctozepto): this req seems arbitrary, they need not be, just routable is fine @@ -178,7 +178,7 @@ state: stopped when: - enable_aodh | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('aodh_api') == -1 - haproxy_vip_prechecks @@ -191,7 +191,7 @@ state: stopped when: - enable_barbican | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('barbican_api') == -1 - haproxy_vip_prechecks @@ -204,7 +204,7 @@ state: stopped when: - enable_blazar | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('blazar_api') == -1 - haproxy_vip_prechecks @@ -217,7 +217,7 @@ state: stopped when: - enable_cinder | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('cinder_api') == -1 - haproxy_vip_prechecks @@ -230,7 +230,7 @@ state: stopped when: - enable_cloudkitty | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('cloudkitty_api') == -1 - haproxy_vip_prechecks @@ -243,7 +243,7 @@ state: stopped when: - enable_cyborg | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('cyborg_api') == -1 - haproxy_vip_prechecks @@ -256,7 +256,7 @@ state: stopped when: - enable_designate | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('designate_api') == -1 - haproxy_vip_prechecks @@ -269,7 +269,7 @@ state: stopped when: - enable_elasticsearch | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('elasticsearch') == -1 - haproxy_vip_prechecks @@ -282,7 +282,7 @@ state: stopped when: - enable_glance | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('glance_api') == -1 - haproxy_vip_prechecks @@ -295,7 +295,7 @@ state: stopped when: - enable_gnocchi | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('gnocchi_api') == -1 - haproxy_vip_prechecks @@ -309,7 +309,7 @@ when: - enable_freezer | bool - haproxy_stat.find('freezer_api') == -1 - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_vip_prechecks - name: Checking free port for Grafana server HAProxy @@ -321,7 +321,7 @@ state: stopped when: - enable_grafana | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('grafana_server') == -1 - haproxy_vip_prechecks @@ -334,7 +334,7 @@ state: stopped when: - enable_heat | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('heat_api') == -1 - haproxy_vip_prechecks @@ -347,7 +347,7 @@ state: stopped when: - enable_heat | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('heat_api_cfn') == -1 - haproxy_vip_prechecks @@ -360,7 +360,7 @@ state: stopped when: - enable_horizon | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('horizon') == -1 - haproxy_vip_prechecks @@ -373,7 +373,7 @@ state: stopped when: - enable_ironic | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('ironic_api') == -1 - haproxy_vip_prechecks @@ -386,7 +386,7 @@ state: stopped when: - enable_ironic | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('ironic_inspector') == -1 - haproxy_vip_prechecks @@ -399,7 +399,7 @@ state: stopped when: - enable_keystone | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('keystone_admin') == -1 - haproxy_vip_prechecks @@ -412,7 +412,7 @@ state: stopped when: - enable_keystone | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('keystone_internal') == -1 - haproxy_vip_prechecks @@ -426,7 +426,7 @@ when: - haproxy_enable_external_vip | bool - enable_keystone | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('keystone_external') == -1 - haproxy_vip_prechecks @@ -439,7 +439,7 @@ state: stopped when: - enable_kibana | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('kibana') == -1 - haproxy_vip_prechecks @@ -452,7 +452,7 @@ state: stopped when: - enable_magnum | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('magnum_api') == -1 - haproxy_vip_prechecks @@ -465,7 +465,7 @@ state: stopped when: - enable_manila | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('manila_api') == -1 - haproxy_vip_prechecks @@ -478,7 +478,7 @@ state: stopped when: - enable_mariadb | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('mariadb') == -1 - haproxy_vip_prechecks @@ -491,7 +491,7 @@ state: stopped when: - enable_masakari | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('masakari_api') == -1 - haproxy_vip_prechecks @@ -504,7 +504,7 @@ state: stopped when: - enable_mistral | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('mistral_api') == -1 - haproxy_vip_prechecks @@ -517,7 +517,7 @@ state: stopped when: - enable_monasca | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('monasca_api') == -1 - haproxy_vip_prechecks @@ -531,7 +531,7 @@ when: - haproxy_enable_external_vip | bool - enable_monasca | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('monasca_api_external') == -1 - haproxy_vip_prechecks @@ -544,7 +544,7 @@ state: stopped when: - enable_monasca | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('monasca_log_api') == -1 - haproxy_vip_prechecks - monasca_log_api_port != monasca_api_port @@ -559,7 +559,7 @@ when: - haproxy_enable_external_vip | bool - enable_monasca | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('monasca_log_api_external') == -1 - haproxy_vip_prechecks - monasca_log_api_port != monasca_api_port @@ -573,7 +573,7 @@ state: stopped when: - enable_murano | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('murano_api') == -1 - haproxy_vip_prechecks @@ -586,7 +586,7 @@ state: stopped when: - enable_neutron | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('neutron_server') == -1 - haproxy_vip_prechecks @@ -599,7 +599,7 @@ state: stopped when: - enable_nova | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('nova_api') == -1 - haproxy_vip_prechecks @@ -612,7 +612,7 @@ state: stopped when: - enable_nova | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('nova_metadata') == -1 - haproxy_vip_prechecks @@ -626,7 +626,7 @@ when: - enable_nova | bool - nova_console == 'novnc' - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('nova_novncproxy') == -1 - haproxy_vip_prechecks @@ -641,7 +641,7 @@ - enable_nova | bool - haproxy_stat.find('nova_serialconsole_proxy') == -1 - enable_nova_serialconsole_proxy | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_vip_prechecks - name: Checking free port for Nova Spice HTML5 HAProxy @@ -654,7 +654,7 @@ when: - enable_nova | bool - nova_console == 'spice' - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('nova_spicehtml5proxy') == -1 - haproxy_vip_prechecks @@ -667,7 +667,7 @@ state: stopped when: - enable_nova | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('placement_api') == -1 - haproxy_vip_prechecks @@ -680,7 +680,7 @@ state: stopped when: - enable_octavia | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('octavia_api') == -1 - haproxy_vip_prechecks @@ -693,7 +693,7 @@ state: stopped when: - enable_rabbitmq | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('rabbitmq_management') == -1 - haproxy_vip_prechecks @@ -705,7 +705,7 @@ state: stopped when: - enable_outward_rabbitmq | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('outward_rabbitmq_management') == -1 - haproxy_vip_prechecks @@ -718,7 +718,7 @@ state: stopped when: - enable_sahara | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('sahara_api') == -1 - haproxy_vip_prechecks @@ -731,7 +731,7 @@ state: stopped when: - enable_senlin | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('senlin_api') == -1 - haproxy_vip_prechecks @@ -744,7 +744,7 @@ state: stopped when: - enable_solum | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('solum_application_deployment') == -1 - haproxy_vip_prechecks @@ -757,7 +757,7 @@ state: stopped when: - enable_solum | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('solum_image_builder') == -1 - haproxy_vip_prechecks @@ -770,7 +770,7 @@ state: stopped when: - enable_swift | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('swift_api') == -1 - haproxy_vip_prechecks @@ -783,7 +783,7 @@ state: stopped when: - enable_tacker | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('tacker_server') == -1 - haproxy_vip_prechecks @@ -796,7 +796,7 @@ state: stopped when: - enable_trove | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('trove_api') == -1 - haproxy_vip_prechecks @@ -809,7 +809,7 @@ state: stopped when: - enable_watcher | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('watcher_api') == -1 - haproxy_vip_prechecks @@ -822,7 +822,7 @@ state: stopped when: - enable_zun | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('zun_api') == -1 - haproxy_vip_prechecks @@ -834,6 +834,6 @@ state: stopped when: - enable_vitrage | bool - - inventory_hostname in groups['haproxy'] + - inventory_hostname in groups['loadbalancer'] - haproxy_stat.find('vitrage_api') == -1 - haproxy_vip_prechecks diff --git a/ansible/roles/prechecks/tasks/inventory_checks.yml b/ansible/roles/prechecks/tasks/inventory_checks.yml new file mode 100644 index 0000000000..f8688f966f --- /dev/null +++ b/ansible/roles/prechecks/tasks/inventory_checks.yml @@ -0,0 +1,11 @@ +--- +- name: Fail if group loadbalancer not exists or it is empty + fail: + msg: >- + Inventory's group loadbalancer does not exist or it is empty. + Please update inventory, as haproxy group was renamed + to loadbalancer in the Xena release. + when: + - enable_loadbalancer | bool + - groups['loadbalancer'] is not defined or + groups['loadbalancer'] | length < 1 diff --git a/ansible/roles/prechecks/tasks/main.yml b/ansible/roles/prechecks/tasks/main.yml index 70da7f82a0..c3b72c41e6 100644 --- a/ansible/roles/prechecks/tasks/main.yml +++ b/ansible/roles/prechecks/tasks/main.yml @@ -1,4 +1,6 @@ --- +- import_tasks: inventory_checks.yml + - include_tasks: host_os_checks.yml when: prechecks_enable_host_os_checks | bool diff --git a/ansible/roles/telegraf/templates/telegraf.conf.j2 b/ansible/roles/telegraf/templates/telegraf.conf.j2 index 2b81a70fd0..de3ab69a8a 100644 --- a/ansible/roles/telegraf/templates/telegraf.conf.j2 +++ b/ansible/roles/telegraf/templates/telegraf.conf.j2 @@ -51,7 +51,7 @@ [[inputs.chrony]] dns_lookup = false {% endif %} -{% if inventory_hostname in groups['haproxy'] and enable_haproxy | bool %} +{% if inventory_hostname in groups['loadbalancer'] and enable_haproxy | bool %} [[inputs.haproxy]] servers = ["{{ haproxy_proto }}://{{ haproxy_user }}:{{ haproxy_password }}@{{ api_interface_address | put_address_in_context('url') }}:{{ haproxy_stats_port }}"] {% endif %} diff --git a/ansible/site.yml b/ansible/site.yml index 5383bd5ed7..832f3912a7 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -120,6 +120,8 @@ - '&enable_loadbalancer_True' serial: '{{ kolla_serial|default("0") }}' tags: + - haproxy + - keepalived - loadbalancer roles: - { role: loadbalancer, diff --git a/doc/source/reference/databases/external-mariadb-guide.rst b/doc/source/reference/databases/external-mariadb-guide.rst index 195568c43a..90b5f79080 100644 --- a/doc/source/reference/databases/external-mariadb-guide.rst +++ b/doc/source/reference/databases/external-mariadb-guide.rst @@ -79,7 +79,7 @@ Using this way, you need to adjust the inventory file: If you choose to use haproxy for load balancing between the members of the cluster, every node within this group needs to be resolvable and reachable from all -the hosts within the ``[haproxy:children]`` group +the hosts within the ``[loadbalancer:children]`` group of your inventory (defaults to ``[network]``). In addition, configure the ``/etc/kolla/globals.yml`` file diff --git a/doc/source/reference/high-availability/haproxy-guide.rst b/doc/source/reference/high-availability/haproxy-guide.rst index ae7d90171e..ad21a971f5 100644 --- a/doc/source/reference/high-availability/haproxy-guide.rst +++ b/doc/source/reference/high-availability/haproxy-guide.rst @@ -9,7 +9,7 @@ Openstack and other services. High-availability in Kolla is implented as via Keepalived and HAProxy. Keepalived manages virtual IP addresses, while HAProxy load-balances traffic to service backends. These two components must be installed on the same hosts -and they are deployed to hosts in the ``haproxy`` group. +and they are deployed to hosts in the ``loadbalancer`` group. Preparation and deployment ~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/source/user/multinode.rst b/doc/source/user/multinode.rst index 78121ed219..4f7501e30a 100644 --- a/doc/source/user/multinode.rst +++ b/doc/source/user/multinode.rst @@ -129,7 +129,7 @@ grouped together and changing these around can break your deployment: [elasticsearch:children] control - [haproxy:children] + [loadbalancer:children] network .. _multinode-host-and-group-variables: diff --git a/releasenotes/notes/drop-group-haproxy-6119957627811873.yaml b/releasenotes/notes/drop-group-haproxy-6119957627811873.yaml new file mode 100644 index 0000000000..516eec5e75 --- /dev/null +++ b/releasenotes/notes/drop-group-haproxy-6119957627811873.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - A new group ``loadbalancer`` is required in inventory file + prior to upgrade. The ``loadbalancer`` group is a replacement + for the ``haproxy`` group. diff --git a/tests/templates/inventory.j2 b/tests/templates/inventory.j2 index 498e85a0a3..e323a78b72 100644 --- a/tests/templates/inventory.j2 +++ b/tests/templates/inventory.j2 @@ -98,7 +98,7 @@ storage monitoring [chrony-server:children] -haproxy +loadbalancer [chrony:children] control @@ -157,12 +157,13 @@ compute [loadbalancer:children] network - +{% if is_previous_release and previous_release == "wallaby" %} [keepalived:children] loadbalancer [haproxy:children] loadbalancer +{% endif %} [mariadb:children] control @@ -768,7 +769,7 @@ storage mariadb [prometheus-haproxy-exporter:children] -haproxy +loadbalancer [prometheus-memcached-exporter:children] memcached