46aeb9843f
When running in check mode, some prechecks previously failed because they use the command module which is silently not run in check mode. Other prechecks were not running correctly in check mode due to e.g. looking for a string in empty command output or not querying which containers are running. This change fixes these issues. Closes-Bug: #2002657 Change-Id: I5219cb42c48d5444943a2d48106dc338aa08fa7c
139 lines
4.2 KiB
YAML
139 lines
4.2 KiB
YAML
---
|
|
- import_role:
|
|
name: service-precheck
|
|
vars:
|
|
service_precheck_services: "{{ nova_cell_services }}"
|
|
service_name: "{{ project_name }}"
|
|
|
|
- name: Get container facts
|
|
become: true
|
|
kolla_container_facts:
|
|
container_engine: "{{ kolla_container_engine }}"
|
|
name:
|
|
- nova_libvirt
|
|
- nova_novncproxy
|
|
- nova_serialproxy
|
|
- nova_spicehtml5proxy
|
|
- nova_ssh
|
|
check_mode: false
|
|
register: container_facts
|
|
|
|
- name: Checking available compute nodes in inventory
|
|
vars:
|
|
nova_compute_ironic: "{{ nova_cell_services['nova-compute-ironic'] }}"
|
|
fail:
|
|
msg: >
|
|
At least 1 compute node required in inventory when ironic is disabled.
|
|
when:
|
|
- groups[nova_cell_compute_group] | length < 1
|
|
- not nova_compute_ironic.enabled | bool
|
|
|
|
- name: Checking free port for Nova NoVNC Proxy
|
|
vars:
|
|
nova_novncproxy: "{{ nova_cell_services['nova-novncproxy'] }}"
|
|
wait_for:
|
|
host: "{{ api_interface_address }}"
|
|
port: "{{ nova_novncproxy_listen_port }}"
|
|
connect_timeout: 1
|
|
timeout: 1
|
|
state: stopped
|
|
when:
|
|
- container_facts['nova_novncproxy'] is not defined
|
|
- nova_novncproxy.enabled | bool
|
|
- inventory_hostname in groups[nova_novncproxy.group]
|
|
|
|
- name: Checking free port for Nova Serial Proxy
|
|
vars:
|
|
nova_serialproxy: "{{ nova_cell_services['nova-serialproxy'] }}"
|
|
wait_for:
|
|
host: "{{ api_interface_address }}"
|
|
port: "{{ nova_serialproxy_listen_port }}"
|
|
connect_timeout: 1
|
|
timeout: 1
|
|
state: stopped
|
|
when:
|
|
- container_facts['nova_serialproxy'] is not defined
|
|
- nova_serialproxy.enabled | bool
|
|
- inventory_hostname in groups[nova_serialproxy.group]
|
|
|
|
- name: Checking free port for Nova Spice HTML5 Proxy
|
|
vars:
|
|
nova_spicehtml5proxy: "{{ nova_cell_services['nova-spicehtml5proxy'] }}"
|
|
wait_for:
|
|
host: "{{ api_interface_address }}"
|
|
port: "{{ nova_spicehtml5proxy_listen_port }}"
|
|
connect_timeout: 1
|
|
timeout: 1
|
|
state: stopped
|
|
when:
|
|
- container_facts['nova_spicehtml5proxy'] is not defined
|
|
- nova_spicehtml5proxy.enabled | bool
|
|
- inventory_hostname in groups[nova_spicehtml5proxy.group]
|
|
|
|
- name: Checking free port for Nova SSH (API interface)
|
|
vars:
|
|
nova_ssh: "{{ nova_cell_services['nova-ssh'] }}"
|
|
wait_for:
|
|
host: "{{ api_interface_address }}"
|
|
port: "{{ nova_ssh_port }}"
|
|
connect_timeout: 1
|
|
timeout: 1
|
|
state: stopped
|
|
when:
|
|
- container_facts['nova_ssh'] is not defined
|
|
- nova_ssh.enabled | bool
|
|
- inventory_hostname in groups[nova_ssh.group]
|
|
|
|
- name: Checking free port for Nova SSH (migration interface)
|
|
vars:
|
|
nova_ssh: "{{ nova_cell_services['nova-ssh'] }}"
|
|
wait_for:
|
|
host: "{{ migration_interface_address }}"
|
|
port: "{{ nova_ssh_port }}"
|
|
connect_timeout: 1
|
|
timeout: 1
|
|
state: stopped
|
|
when:
|
|
- migration_interface_address != api_interface_address
|
|
- container_facts['nova_ssh'] is not defined
|
|
- nova_ssh.enabled | bool
|
|
- inventory_hostname in groups[nova_ssh.group]
|
|
|
|
- name: Checking free port for Nova Libvirt
|
|
vars:
|
|
nova_libvirt: "{{ nova_cell_services['nova-libvirt'] }}"
|
|
wait_for:
|
|
host: "{{ api_interface_address }}"
|
|
port: "{{ nova_libvirt_port }}"
|
|
connect_timeout: 1
|
|
timeout: 1
|
|
state: stopped
|
|
when:
|
|
- container_facts['nova_libvirt'] is not defined
|
|
- nova_libvirt.enabled | bool
|
|
- inventory_hostname in groups[nova_libvirt.group]
|
|
|
|
- name: Checking that host libvirt is not running
|
|
vars:
|
|
nova_libvirt: "{{ nova_cell_services['nova-libvirt'] }}"
|
|
stat: path=/var/run/libvirt/libvirt-sock
|
|
register: result
|
|
failed_when: result.stat.exists
|
|
when:
|
|
- container_facts['nova_libvirt'] is not defined
|
|
- nova_libvirt.enabled | bool
|
|
- inventory_hostname in groups[nova_libvirt.group]
|
|
|
|
- name: Checking that nova_libvirt container is not running
|
|
vars:
|
|
nova_libvirt: "{{ nova_cell_services['nova-libvirt'] }}"
|
|
fail:
|
|
msg: >-
|
|
The nova_libvirt container is running, however it has been disabled via
|
|
the 'enable_nova_libvirt_container' flag. Stop and remove the container
|
|
manually, taking care to migrate any state to the host libvirt daemon.
|
|
when:
|
|
- container_facts['nova_libvirt'] is defined
|
|
- not nova_libvirt.enabled | bool
|
|
- inventory_hostname in groups[nova_libvirt.group]
|