From 6a9a0e927dc0812d093460418b801539401de61d Mon Sep 17 00:00:00 2001 From: Victor Coutellier Date: Tue, 24 Jul 2018 13:57:56 -0400 Subject: [PATCH] Fix prechecks for adding a new haproxy node Change-Id: I2615e4938ec6b4a525f7fddde5a51a139dced8de Closes-Bug: #1783381 --- ansible/roles/haproxy/tasks/precheck.yml | 83 ++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index 717267f94c..e5631d8f91 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -37,6 +37,37 @@ check_mode: no run_once: true +- name: Clearing temp kolla_haproxy_running file + local_action: file path=/tmp/kolla_haproxy_running state=absent + changed_when: False + check_mode: no + run_once: true + +- name: Create empty temp kolla_haproxy_running file + local_action: copy content=None dest=/tmp/kolla_haproxy_running mode=0644 + changed_when: False + check_mode: no + run_once: true + +- name: Getting hosts who is running haproxy + local_action: copy content={{ ansible_hostname }} dest=/tmp/kolla_haproxy_running mode=0644 + changed_when: False + check_mode: no + when: + - inventory_hostname in groups['haproxy'] + - container_facts['haproxy'] is defined + - enable_haproxy | bool + +- name: Registering host running haproxy + set_fact: + host_running_haproxy: "{{ lookup('file', '/tmp/kolla_haproxy_running') }}" + +- name: Clearing temp kolla_haproxy_running file + local_action: file path=/tmp/kolla_haproxy_running state=absent + changed_when: False + check_mode: no + run_once: true + - name: Checking if haproxy certificate exists run_once: true local_action: stat path={{ kolla_external_fqdn_cert }} @@ -121,6 +152,7 @@ - enable_aodh | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('aodh_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Barbican API HAProxy wait_for: @@ -133,6 +165,7 @@ - enable_barbican | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('barbican_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Blazar API HAProxy wait_for: @@ -145,6 +178,7 @@ - enable_blazar | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('blazar_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Cinder API HAProxy wait_for: @@ -157,6 +191,7 @@ - enable_cinder | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('cinder_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Cloudkitty API HAProxy wait_for: @@ -169,6 +204,7 @@ - enable_cloudkitty | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('cloudkitty_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Congress API HAProxy wait_for: @@ -181,6 +217,7 @@ - enable_congress | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('congress_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Designate API HAProxy wait_for: @@ -193,6 +230,7 @@ - enable_designate | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('designate_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Elasticsearch HAProxy wait_for: @@ -205,6 +243,7 @@ - enable_elasticsearch | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('elasticsearch') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Glance API HAProxy wait_for: @@ -217,6 +256,7 @@ - enable_glance | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('glance_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Glance Registry HAProxy wait_for: @@ -229,6 +269,7 @@ - enable_glance | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('glance_registry') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Gnocchi API HAProxy wait_for: @@ -241,6 +282,7 @@ - enable_gnocchi | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('gnocchi_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Freezer API HAProxy wait_for: @@ -253,6 +295,7 @@ - enable_freezer | bool - haproxy_stat.find('freezer_api') == -1 - inventory_hostname in groups['haproxy'] + - "host_running_haproxy == 'None'" - name: Checking free port for Grafana server HAProxy wait_for: @@ -265,6 +308,7 @@ - enable_grafana | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('grafana_server') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Heat API HAProxy wait_for: @@ -277,6 +321,7 @@ - enable_heat | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('heat_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Heat API CFN HAProxy wait_for: @@ -289,6 +334,7 @@ - enable_heat | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('heat_api_cfn') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Horizon HAProxy wait_for: @@ -301,6 +347,7 @@ - enable_horizon | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('horizon') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Ironic API HAProxy wait_for: @@ -313,6 +360,7 @@ - enable_ironic | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('ironic_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Ironic Inspector HAProxy wait_for: @@ -325,6 +373,7 @@ - enable_ironic | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('ironic_inspector') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Karbor Admin HAProxy wait_for: @@ -337,6 +386,7 @@ - enable_karbor | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('karbor_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Keystone Admin HAProxy wait_for: @@ -349,6 +399,7 @@ - enable_keystone | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('keystone_admin') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Keystone Internal HAProxy wait_for: @@ -361,6 +412,7 @@ - enable_keystone | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('keystone_internal') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Keystone Public HAProxy wait_for: @@ -374,6 +426,7 @@ - enable_keystone | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('keystone_external') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Kibana HAProxy wait_for: @@ -386,6 +439,7 @@ - enable_kibana | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('kibana') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Magnum API HAProxy wait_for: @@ -398,6 +452,7 @@ - enable_magnum | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('magnum_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Manila API HAProxy wait_for: @@ -410,6 +465,7 @@ - enable_manila | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('manila_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for MariaDB HAProxy wait_for: @@ -422,6 +478,7 @@ - enable_mariadb | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('mariadb') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Mistral API HAProxy wait_for: @@ -434,6 +491,7 @@ - enable_mistral | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('mistral_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Mongodb HAProxy wait_for: @@ -446,6 +504,7 @@ - enable_mongodb | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('mongodb') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Murano API HAProxy wait_for: @@ -458,6 +517,7 @@ - enable_murano | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('murano_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Neutron Server HAProxy wait_for: @@ -470,6 +530,7 @@ - enable_neutron | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('neutron_server') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Nova API HAProxy wait_for: @@ -482,6 +543,7 @@ - enable_nova | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('nova_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Nova Metadata HAProxy wait_for: @@ -494,6 +556,7 @@ - enable_nova | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('nova_metadata') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Nova NoVNC HAProxy wait_for: @@ -507,6 +570,7 @@ - nova_console == 'novnc' - inventory_hostname in groups['haproxy'] - haproxy_stat.find('nova_novncproxy') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Nova Serial Proxy HAProxy wait_for: @@ -520,6 +584,7 @@ - haproxy_stat.find('nova_serialconsole_proxy') == -1 - enable_nova_serialconsole_proxy | bool - inventory_hostname in groups['haproxy'] + - "host_running_haproxy == 'None'" - name: Checking free port for Nova Spice HTML5 HAProxy wait_for: @@ -533,6 +598,7 @@ - nova_console == 'spice' - inventory_hostname in groups['haproxy'] - haproxy_stat.find('nova_spicehtml5proxy') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Nova Placement API HAProxy wait_for: @@ -545,6 +611,7 @@ - enable_nova | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('placement_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Octavia API HAProxy wait_for: @@ -557,6 +624,7 @@ - enable_octavia | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('octavia_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Panko API HAProxy wait_for: @@ -569,6 +637,7 @@ - enable_panko | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('panko_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for RabbitMQ Management HAProxy wait_for: @@ -581,6 +650,7 @@ - enable_rabbitmq | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('rabbitmq_management') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for outward RabbitMQ Management HAProxy wait_for: @@ -592,6 +662,7 @@ - enable_outward_rabbitmq | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('outward_rabbitmq_management') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for RadosGW HAProxy wait_for: @@ -604,6 +675,7 @@ - enable_ceph_rgw | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('radosgw') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Sahara API HAProxy wait_for: @@ -616,6 +688,7 @@ - enable_sahara | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('sahara_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Searchlight API HAProxy wait_for: @@ -628,6 +701,7 @@ - enable_searchlight | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('searchlight_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Senlin API HAProxy wait_for: @@ -640,6 +714,7 @@ - enable_senlin | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('senlin_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Solum Application Deployment HAProxy wait_for: @@ -652,6 +727,7 @@ - enable_solum | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('solum_application_deployment') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Solum Image Builder HAProxy wait_for: @@ -664,6 +740,7 @@ - enable_solum | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('solum_image_builder') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Swift Proxy Server HAProxy wait_for: @@ -676,6 +753,7 @@ - enable_swift | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('swift_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Tacker Server HAProxy wait_for: @@ -688,6 +766,7 @@ - enable_tacker | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('tacker_server') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Trove API HAProxy wait_for: @@ -700,6 +779,7 @@ - enable_trove | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('trove_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Watcher API HAProxy wait_for: @@ -712,6 +792,7 @@ - enable_watcher | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('watcher_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Zun API HAProxy wait_for: @@ -724,6 +805,7 @@ - enable_zun | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('zun_api') == -1 + - "host_running_haproxy == 'None'" - name: Checking free port for Vitrage API HAProxy wait_for: @@ -735,3 +817,4 @@ - enable_vitrage | bool - inventory_hostname in groups['haproxy'] - haproxy_stat.find('vitrage_api') == -1 + - "host_running_haproxy == 'None'"