Skip to content
Snippets Groups Projects
  • Mark Goddard's avatar
    49fb55f1
    Add Ansible group check to prechecks · 49fb55f1
    Mark Goddard authored
    We assume that all groups are present in the inventory, and quite obtuse
    errors can result if any are not.
    
    This change adds a precheck that checks for the presence of all expected
    groups in the inventory for each service. It also introduces a common
    service-precheck role that we can use for other common prechecks.
    
    Change-Id: Ia0af1e7df4fff7f07cd6530e5b017db8fba530b3
    Partially-Implements: blueprint improve-prechecks
    49fb55f1
    History
    Add Ansible group check to prechecks
    Mark Goddard authored
    We assume that all groups are present in the inventory, and quite obtuse
    errors can result if any are not.
    
    This change adds a precheck that checks for the presence of all expected
    groups in the inventory for each service. It also introduces a common
    service-precheck role that we can use for other common prechecks.
    
    Change-Id: Ia0af1e7df4fff7f07cd6530e5b017db8fba530b3
    Partially-Implements: blueprint improve-prechecks
precheck.yml 3.16 KiB
---
- 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:
    name:
      - nova_libvirt
      - nova_novncproxy
      - nova_serialproxy
      - nova_spicehtml5proxy
      - nova_ssh
  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]