kolla-ansible/ansible/roles/neutron/tasks/precheck.yml
Michal Nasiadka 1009931162 Change local_action to delegate_to: localhost
As part of the effort to implement Ansible code linting in CI
(using ansible-lint) - we need to implement recommendations from
ansible-lint output [1].

One of them is to stop using local_action in favor of delegate_to -
to increase readability and and match the style of typical ansible
tasks.

[1]: https://review.opendev.org/694779/

Partially implements: blueprint ansible-lint

Change-Id: I46c259ddad5a6aaf9c7301e6c44cd8a1d5c457d3
2019-11-22 15:04:44 +00:00

49 lines
1.5 KiB
YAML

---
- name: Get container facts
become: true
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
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
- 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 }}"
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
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)