4ce47e2250
Refactor that prepares kolla_container_facts module for introducing more actions that will be moved from kolla_container module and kolla_container_volume_facts. This change is based on a discussion about adding a new action to kolla_container module that retrieves all names of the running containers. It was agreed that kolla-ansible should follow Ansible's direction of splitting modules between action modules and facts modules. Because of this, kolla_container_facts needs to be able to handle different requests for data about containers or volumes. Change-Id: Ieaec8f64922e4e5a2199db2d6983518b124cb4aa Signed-off-by: Ivan Halomi <ivan.halomi@tietoevry.com>
88 lines
2.5 KiB
YAML
88 lines
2.5 KiB
YAML
---
|
|
- import_role:
|
|
name: service-precheck
|
|
vars:
|
|
service_precheck_services: "{{ ironic_services }}"
|
|
service_name: "{{ project_name }}"
|
|
|
|
- name: Get container facts
|
|
become: true
|
|
kolla_container_facts:
|
|
action: get_containers
|
|
container_engine: "{{ kolla_container_engine }}"
|
|
name:
|
|
- ironic_api
|
|
- ironic_inspector
|
|
- ironic_http
|
|
check_mode: false
|
|
register: container_facts
|
|
|
|
- name: Checking free port for Ironic API
|
|
wait_for:
|
|
host: "{{ api_interface_address }}"
|
|
port: "{{ ironic_api_listen_port }}"
|
|
connect_timeout: 1
|
|
timeout: 1
|
|
state: stopped
|
|
when:
|
|
- container_facts['ironic_api'] is not defined
|
|
- inventory_hostname in groups['ironic-api']
|
|
|
|
- name: Checking free port for Ironic Inspector
|
|
wait_for:
|
|
host: "{{ api_interface_address }}"
|
|
port: "{{ ironic_inspector_listen_port }}"
|
|
connect_timeout: 1
|
|
timeout: 1
|
|
state: stopped
|
|
when:
|
|
- container_facts['ironic_inspector'] is not defined
|
|
- inventory_hostname in groups['ironic-inspector']
|
|
|
|
- name: Checking free port for Ironic HTTP server
|
|
wait_for:
|
|
host: "{{ api_interface_address }}"
|
|
port: "{{ ironic_http_port }}"
|
|
connect_timeout: 1
|
|
timeout: 1
|
|
state: stopped
|
|
when:
|
|
- container_facts['ironic_http'] is not defined
|
|
- inventory_hostname in groups['ironic-http']
|
|
|
|
- name: Checking free port for Ironic Prometheus Exporter
|
|
wait_for:
|
|
host: "{{ api_interface_address }}"
|
|
port: "{{ ironic_prometheus_exporter_port }}"
|
|
connect_timeout: 1
|
|
timeout: 1
|
|
state: stopped
|
|
when:
|
|
- enable_ironic_prometheus_exporter | bool
|
|
- container_facts['ironic_prometheus_exporter'] is not defined
|
|
- inventory_hostname in groups['ironic-conductor']
|
|
|
|
- name: Checking ironic-agent files exist for Ironic Inspector
|
|
stat:
|
|
path: "{{ ironic_agent_files_directory }}/ironic/{{ item }}"
|
|
delegate_to: localhost
|
|
run_once: True
|
|
register: result
|
|
failed_when: not result.stat.exists
|
|
when:
|
|
# Only required when Ironic inspector is in use.
|
|
- groups['ironic-inspector'] | length > 0
|
|
- (not ironic_dnsmasq_serve_ipxe | bool and inventory_hostname in groups['ironic-tftp']) or
|
|
(ironic_dnsmasq_serve_ipxe | bool and inventory_hostname in groups['ironic-http'])
|
|
with_items:
|
|
- "ironic-agent.kernel"
|
|
- "ironic-agent.initramfs"
|
|
|
|
- name: Ensure ironic_dnsmasq_dhcp_ranges is configured
|
|
fail:
|
|
msg: >
|
|
ironic_dnsmasq_dhcp_ranges must be a list
|
|
connection: local
|
|
run_once: True
|
|
when: not ironic_dnsmasq_dhcp_ranges is sequence
|