- block: - name: is additonal Cell? set_fact: nova_additional_cell: false - block: - name: discover via nova_compute? set_fact: nova_cellv2_discovery_delegate_host: '{{ groups[''nova_compute''][0] }}' when: - groups['nova_compute'] is defined and (groups['nova_compute']|length>0) - name: discover via nova_ironic? set_fact: nova_cellv2_discovery_delegate_host: '{{ groups[''nova_ironic''][0] }}' when: - nova_cellv2_discovery_delegate_host is not defined - groups['nova_ironic'] is defined and (groups['nova_ironic']|length>0) - become: true changed_when: false command: '{{ container_cli }} exec nova_compute nova-manage cell_v2 discover_hosts --by-service' delegate_to: '{{ nova_cellv2_discovery_delegate_host }}' name: Discovering nova hosts when: - nova_cellv2_discovery_delegate_host is defined - set_fact: nova_cellv2_discovery_done: true name: check if discover hosts is required when: - not nova_additional_cell|bool - nova_cellv2_discovery_done is not defined