tenks/ansible/node_enrolment.yml
Mark Goddard 6a2fb44a78 Fix deploy and teardown without node enrolment
If the ironic_config field is not present in a node definition, then
that node should not be registered with ironic. In this case we also
don't need to query glance for images or wait for resources to appear
in placement.

If nova_flavors is empty, we do not need to register flavors, so no need
to install the client or check for OS_USERNAME.

Also fixes an issue in the action plugin where it would fail if
ironic_config field is not present in a node definition.

Finally, in CI deploy/teardown tests, rather than skipping tasks, we now
remove the ironic_config field from the node definition, and set
nova_flavors to empty, such that we exercise these code paths.

Change-Id: I29b42665f1609c99e80f12ab6f3815d0e0918dae
Story: 2004412
Task: 28056
2018-11-22 19:20:59 +00:00

23 lines
799 B
YAML

- hosts: localhost
tasks:
- name: Load state from file
include_vars:
file: "{{ state_file_path }}"
name: tenks_state
- name: Perform Ironic enrolment for each hypervisor's nodes
include_role:
name: ironic-enrolment
vars:
ironic_deploy_kernel: "{{ deploy_kernel }}"
ironic_deploy_ramdisk: "{{ deploy_ramdisk }}"
ironic_nodes: "{{ alloc.value.nodes }}"
ironic_hypervisor: "{{ alloc.key }}"
ironic_virtualenv_path: "{{ virtualenv_path }}"
ironic_python_upper_constraints_url: >-
{{ python_upper_constraints_url }}
loop: "{{ query('dict', tenks_state) }}"
loop_control:
loop_var: alloc
when: ironic_nodes | selectattr('ironic_config', 'defined') | list | length > 0