- hosts: localhost tasks: - name: Load state from file include_vars: file: "{{ state_file_path }}" name: tenks_state - name: Check that OpenStack credentials exist in the environment fail: msg: > $OS_USERNAME was not found in the environment. Ensure the OpenStack credentials exist in your environment, perhaps by sourcing your RC file. when: not lookup('env', 'OS_USERNAME') - name: Perform Ironic enrolment for each hypervisor's nodes include_role: name: ironic-enrolment vars: ironic_deploy_kernel_uuid: "{{ deploy_kernel_uuid }}" ironic_deploy_ramdisk_uuid: "{{ deploy_ramdisk_uuid }}" # FIXME(w-miller): Set absent/present in tenks_schedule on a per-node # basis to account for existing allocations, rather than for all nodes # here. ironic_nodes: >- {{ alloc.value.nodes | map('combine', {'state': ('absent' if cmd == 'teardown' else 'present')}) | list }} 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