kolla-ansible/ansible/roles/neutron/tasks/precheck.yml
Gary Perkins 958efcef73 Fix Neutron precheck to not fail with newer Docker
With newer Docker versions `systemctl show docker` returns:

  MountFlags=shared

Instead of:

  MountFlags=1048576

This fix accepts either value as valid to ensure the check is not
erroneously failing.

Closes-Bug: #1791365

Change-Id: I2bd626466d6a0e189e0d85877b2be8f2b4bb37f4
2019-03-11 11:15:13 +00:00

61 lines
2.4 KiB
YAML

---
- name: Get container facts
kolla_container_facts:
name:
- neutron_server
register: container_facts
- name: Checking free port for Neutron Server
wait_for:
host: "{{ api_interface_address }}"
port: "{{ neutron_server_listen_port }}"
connect_timeout: 1
timeout: 1
state: stopped
when:
- container_facts['neutron_server'] is not defined
- inventory_hostname in groups['neutron-server']
- name: Checking number of network agents
local_action: fail msg="Number of network agents are less than two when enabling agent ha"
changed_when: false
run_once: True
when:
- enable_neutron_agent_ha | bool
- groups['neutron-dhcp-agent'] | length < 2
or groups['neutron-l3-agent'] | length < 2
# When MountFlags is set to shared, a signal bit configured on 20th bit of a number
# We need to check the 20th bit. 2^20 = 1048576. So we are validating against it.
# In some systems MountFlags on the Docker service is set to 'shared', whereas
# in others it's set to the decimal value of the 20th bit. This now checks for both
# values. Either '1048576' or 'shared' will pass the precheck.
- name: Checking if 'MountFlags' for docker service is set to 'shared'
command: systemctl show docker
register: result
changed_when: false
failed_when: result.stdout.find('MountFlags=1048576') == -1 and result.stdout.find('MountFlags=shared') == -1
when:
- (inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent'])
- ansible_os_family == 'RedHat' or ansible_distribution == 'Ubuntu'
- name: Checking tenant network types
vars:
type_drivers: "{{ neutron_type_drivers.replace(' ', '').split(',') | reject('equalto', '') | list }}"
tenant_network_types: "{{ neutron_tenant_network_types.replace(' ', '').split(',') | reject('equalto', '') | list }}"
local_action: fail msg="Tenant network type '{{ item }}' is not in type drivers [{{ neutron_type_drivers }}]"
changed_when: false
when: item not in type_drivers
run_once: true
with_items: "{{ tenant_network_types }}"
- name: Checking whether Ironic enabled
local_action: fail msg="Ironic must be enabled when using networking-baremetal/ironic-neutron-agent"
changed_when: false
run_once: True
when:
- enable_ironic_neutron_agent | bool
- not (enable_ironic | bool)