kolla-ansible/ansible/roles/haproxy/tasks/precheck.yml
root 2364bee3cc Add zun ansible role
Change-Id: I13cf03d6a97fb94dd7cb309e99a417ad101dc21a
Co-Authored-By: Mauricio Lima <mauriciolimab@gmail.com>
Partially-implements: bp add-zun-ansible-role
2017-03-30 04:15:17 -04:00

635 lines
18 KiB
YAML

---
- name: Get container facts
kolla_container_facts:
name:
- haproxy
- keepalived
register: container_facts
- name: Clearing temp kolla_keepalived_running file
local_action: file path=/tmp/kolla_keepalived_running state=absent
changed_when: False
always_run: True
- name: Create empty temp kolla_keepalived_running file
local_action: copy content=None dest=/tmp/kolla_keepalived_running mode=0644
changed_when: False
always_run: True
- name: Getting hosts who is running keepalived
local_action: copy content={{ ansible_hostname }} dest=/tmp/kolla_keepalived_running mode=0644
changed_when: False
always_run: True
when:
- inventory_hostname in groups['haproxy']
- container_facts['keepalived'] is defined
- enable_haproxy | bool
- name: Registering host running keepalived
set_fact:
host_running_keepalived: "{{ lookup('file', '/tmp/kolla_keepalived_running') }}"
- name: Clearing temp kolla_keepalived_running file
local_action: file path=/tmp/kolla_keepalived_running state=absent
changed_when: False
always_run: True
- name: Checking if kolla_internal_vip_address and kolla_external_vip_address are not pingable from any node
command: ping -c 3 {{ item }}
register: ping_output
changed_when: false
failed_when: ping_output.rc != 1
with_items:
- "{{ kolla_internal_vip_address }}"
- "{{ kolla_external_vip_address }}"
when:
- "host_running_keepalived == 'None'"
- enable_haproxy | bool
- name: Checking free port for HAProxy stats
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ haproxy_stats_port }}"
connect_timeout: 1
state: stopped
when:
- enable_haproxy | bool
- container_facts['haproxy'] is not defined
- inventory_hostname in groups['haproxy']
- name: Checking if kolla_internal_vip_address is in the same network as api_interface on all nodes
command: ip -4 -o addr show dev {{ api_interface }}
register: ip_addr_output
changed_when: false
failed_when: >-
'169.254.' not in kolla_internal_vip_address and
kolla_internal_vip_address | ipaddr(ip_addr_output.stdout.split()[3]) is none
when:
- enable_haproxy | bool
- container_facts['keepalived'] is not defined
- inventory_hostname in groups['haproxy']
- name: Getting haproxy stat
shell: echo "show stat" | docker exec -i haproxy socat unix-connect:/var/lib/kolla/haproxy/haproxy.sock stdio
register: haproxy_stat_shell
changed_when: false
failed_when: false
when: container_facts['haproxy'] is defined
- set_fact:
haproxy_stat: "{{ haproxy_stat_shell.stdout|default('') }}"
- name: Checking free port for Aodh API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ aodh_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_aodh | bool
- inventory_hostname in groups['haproxy']
- "{{ 'aodh_api' not in haproxy_stat }}"
- name: Checking free port for Barbican API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ barbican_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_barbican | bool
- inventory_hostname in groups['haproxy']
- "{{ 'barbican_api' not in haproxy_stat }}"
- name: Checking free port for Ceilometer API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ ceilometer_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_ceilometer | bool
- inventory_hostname in groups['haproxy']
- "{{ 'ceilometer_api' not in haproxy_stat }}"
- name: Checking free port for Cinder API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ cinder_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_cinder | bool
- inventory_hostname in groups['haproxy']
- "{{ 'cinder_api' not in haproxy_stat }}"
- name: Checking free port for Cloudkitty API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ cloudkitty_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_cloudkitty | bool
- inventory_hostname in groups['haproxy']
- "{{ 'cloudkitty_api' not in haproxy_stat }}"
- name: Checking free port for Congress API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ congress_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_congress | bool
- inventory_hostname in groups['haproxy']
- "{{ 'congress_api' not in haproxy_stat }}"
- name: Checking free port for Designate API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ designate_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_designate | bool
- inventory_hostname in groups['haproxy']
- "{{ 'designate_api' not in haproxy_stat }}"
- name: Checking free port for Elasticsearch HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ elasticsearch_port }}"
connect_timeout: 1
state: stopped
when:
- enable_elasticsearch | bool
- inventory_hostname in groups['haproxy']
- "{{ 'elasticsearch' not in haproxy_stat }}"
- name: Checking free port for Glance API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ glance_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_glance | bool
- inventory_hostname in groups['haproxy']
- "{{ 'glance_api' not in haproxy_stat }}"
- name: Checking free port for Glance Registry HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ glance_registry_port }}"
connect_timeout: 1
state: stopped
when:
- enable_glance | bool
- inventory_hostname in groups['haproxy']
- "{{ 'glance_registry' not in haproxy_stat }}"
- name: Checking free port for Gnocchi API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ gnocchi_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_gnocchi | bool
- inventory_hostname in groups['haproxy']
- "{{ 'gnocchi_api' not in haproxy_stat }}"
- name: Checking free port for Freezer API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ freezer_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_freezer | bool
- "{{ 'freezer_api' not in haproxy_stat }}"
- inventory_hostname in groups['haproxy']
- name: Checking free port for Grafana server HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ grafana_server_port }}"
connect_timeout: 1
state: stopped
when:
- enable_grafana | bool
- inventory_hostname in groups['haproxy']
- "{{ 'grafana_server' not in haproxy_stat }}"
- name: Checking free port for Heat API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ heat_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_heat | bool
- inventory_hostname in groups['haproxy']
- "{{ 'heat_api' not in haproxy_stat }}"
- name: Checking free port for Heat API CFN HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ heat_api_cfn_port }}"
connect_timeout: 1
state: stopped
when:
- enable_heat | bool
- inventory_hostname in groups['haproxy']
- "{{ 'heat_api_cfn' not in haproxy_stat }}"
- name: Checking free port for Horizon HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ horizon_port }}"
connect_timeout: 1
state: stopped
when:
- enable_horizon | bool
- inventory_hostname in groups['haproxy']
- "{{ 'horizon' not in haproxy_stat }}"
- name: Checking free port for Ironic API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ ironic_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_ironic | bool
- inventory_hostname in groups['haproxy']
- "{{ 'ironic_api' not in haproxy_stat }}"
- name: Checking free port for Ironic Inspector HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ ironic_inspector_port }}"
connect_timeout: 1
state: stopped
when:
- enable_ironic | bool
- inventory_hostname in groups['haproxy']
- "{{ 'ironic_inspector' not in haproxy_stat }}"
- name: Checking free port for Karbor Admin HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ karbor_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_karbor | bool
- inventory_hostname in groups['haproxy']
- "{{ 'karbor_api' not in haproxy_stat }}"
- name: Checking free port for Keystone Admin HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ keystone_admin_port }}"
connect_timeout: 1
state: stopped
when:
- enable_keystone | bool
- inventory_hostname in groups['haproxy']
- "{{ 'keystone_admin' not in haproxy_stat }}"
- name: Checking free port for Keystone Internal HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ keystone_public_port }}"
connect_timeout: 1
state: stopped
when:
- enable_keystone | bool
- inventory_hostname in groups['haproxy']
- "{{ 'keystone_internal' not in haproxy_stat }}"
- name: Checking free port for Keystone Public HAProxy
wait_for:
host: "{{ kolla_external_vip_address }}"
port: "{{ keystone_public_port }}"
connect_timeout: 1
state: stopped
when:
- haproxy_enable_external_vip | bool
- enable_keystone | bool
- inventory_hostname in groups['haproxy']
- "{{ 'keystone_external' not in haproxy_stat }}"
- name: Checking free port for Kibana HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ kibana_server_port }}"
connect_timeout: 1
state: stopped
when:
- enable_kibana | bool
- inventory_hostname in groups['haproxy']
- "{{ 'kibana' not in haproxy_stat }}"
- name: Checking free port for Magnum API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ magnum_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_magnum | bool
- inventory_hostname in groups['haproxy']
- "{{ 'magnum_api' not in haproxy_stat }}"
- name: Checking free port for Manila API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ manila_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_manila | bool
- inventory_hostname in groups['haproxy']
- "{{ 'manila_api' not in haproxy_stat }}"
- name: Checking free port for MariaDB HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ database_port }}"
connect_timeout: 1
state: stopped
when:
- enable_mariadb | bool
- inventory_hostname in groups['haproxy']
- "{{ 'mariadb' not in haproxy_stat }}"
- name: Checking free port for Mistral API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ mistral_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_mistral | bool
- inventory_hostname in groups['haproxy']
- "{{ 'mistral_api' not in haproxy_stat }}"
- name: Checking free port for Mongodb HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ mongodb_port }}"
connect_timeout: 1
state: stopped
when:
- enable_mongodb | bool
- inventory_hostname in groups['haproxy']
- "{{ 'mongodb' not in haproxy_stat }}"
- name: Checking free port for Murano API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ murano_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_murano | bool
- inventory_hostname in groups['haproxy']
- "{{ 'murano_api' not in haproxy_stat }}"
- name: Checking free port for Neutron Server HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ neutron_server_port }}"
connect_timeout: 1
state: stopped
when:
- enable_neutron | bool
- inventory_hostname in groups['haproxy']
- "{{ 'neutron_server' not in haproxy_stat }}"
- name: Checking free port for Nova API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ nova_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_nova | bool
- inventory_hostname in groups['haproxy']
- "{{ 'nova_api' not in haproxy_stat }}"
- name: Checking free port for Nova Metadata HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ nova_metadata_port }}"
connect_timeout: 1
state: stopped
when:
- enable_nova | bool
- inventory_hostname in groups['haproxy']
- "{{ 'nova_metadata' not in haproxy_stat }}"
- name: Checking free port for Nova NoVNC HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ nova_novncproxy_port }}"
connect_timeout: 1
state: stopped
when:
- enable_nova | bool
- nova_console == 'novnc'
- inventory_hostname in groups['haproxy']
- "{{ 'nova_novncproxy' not in haproxy_stat }}"
- name: Checking free port for Nova Serial Proxy HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ nova_serialproxy_port }}"
connect_timeout: 1
state: stopped
when:
- enable_nova | bool
- "{{ 'nova_serialconsole_proxy' not in haproxy_stat }}"
- enable_nova_serialconsole_proxy | bool
- inventory_hostname in groups['haproxy']
- name: Checking free port for Nova Spice HTML5 HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ nova_spicehtml5proxy_port }}"
connect_timeout: 1
state: stopped
when:
- enable_nova | bool
- nova_console == 'spice'
- inventory_hostname in groups['haproxy']
- "{{ 'nova_spicehtml5proxy' not in haproxy_stat }}"
- name: Checking free port for Nova Placement API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ placement_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_nova | bool
- inventory_hostname in groups['haproxy']
- "{{ 'placement_api' not in haproxy_stat }}"
- name: Checking free port for Octavia API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ octavia_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_octavia | bool
- inventory_hostname in groups['haproxy']
- "{{ 'octavia_api' not in haproxy_stat }}"
- name: Checking free port for Panko API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ panko_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_panko | bool
- inventory_hostname in groups['haproxy']
- "{{ 'panko_api' not in haproxy_stat }}"
- name: Checking free port for RabbitMQ Management HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ rabbitmq_management_port }}"
connect_timeout: 1
state: stopped
when:
- enable_rabbitmq | bool
- inventory_hostname in groups['haproxy']
- "{{ 'rabbitmq_management' not in haproxy_stat }}"
- name: Checking free port for RadosGW HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ rgw_port }}"
connect_timeout: 1
state: stopped
when:
- enable_ceph_rgw | bool
- inventory_hostname in groups['haproxy']
- "{{ 'radosgw' not in haproxy_stat }}"
- name: Checking free port for Sahara API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ sahara_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_sahara | bool
- inventory_hostname in groups['haproxy']
- "{{ 'sahara_api' not in haproxy_stat }}"
- name: Checking free port for Searchlight API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ searchlight_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_searchlight | bool
- inventory_hostname in groups['haproxy']
- "{{ 'searchlight_api' not in haproxy_stat }}"
- name: Checking free port for Senlin API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ senlin_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_senlin | bool
- inventory_hostname in groups['haproxy']
- "{{ 'senlin_api' not in haproxy_stat }}"
- name: Checking free port for Solum Application Deployment HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ solum_application_deployment_port }}"
connect_timeout: 1
state: stopped
when:
- enable_solum | bool
- inventory_hostname in groups['haproxy']
- "{{ 'solum_application_deployment' not in haproxy_stat }}"
- name: Checking free port for Solum Image Builder HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ solum_image_builder_port }}"
connect_timeout: 1
state: stopped
when:
- enable_solum | bool
- inventory_hostname in groups['haproxy']
- "{{ 'solum_image_builder' not in haproxy_stat }}"
- name: Checking free port for Swift Proxy Server HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ swift_proxy_server_port }}"
connect_timeout: 1
state: stopped
when:
- enable_swift | bool
- inventory_hostname in groups['haproxy']
- "{{ 'swift_api' not in haproxy_stat }}"
- name: Checking free port for Tacker Server HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ tacker_server_port }}"
connect_timeout: 1
state: stopped
when:
- enable_tacker | bool
- inventory_hostname in groups['haproxy']
- "{{ 'tacker_server' not in haproxy_stat }}"
- name: Checking free port for Trove API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ trove_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_trove | bool
- inventory_hostname in groups['haproxy']
- "{{ 'trove_api' not in haproxy_stat }}"
- name: Checking free port for Watcher API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ watcher_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_watcher | bool
- inventory_hostname in groups['haproxy']
- "{{ 'watcher_api' not in haproxy_stat }}"
- name: Checking free port for Zun API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ zun_api_port }}"
connect_timeout: 1
state: stopped
when:
- enable_zun | bool
- inventory_hostname in groups['haproxy']
- "{{ 'zun_api' not in haproxy_stat }}"