tenks/ansible/enrol_nodes.yml
Will Miller cfb7c05e30 Move node enrolment up a level
Call node enrolment from the top level deploy.yml playbook, to make it
easier to skip enrolment if necessary. Rename to fit the scheme of
second-level playbooks.

Also, fix variable scoping issues by giving a different name to the
temporary variable used when calling the scheduling module. This ensures
that all future tasks correctly reference the allocations from the file.
2018-09-06 09:08:11 +00:00

29 lines
1.0 KiB
YAML

- hosts: localhost
tasks:
- name: Load allocations from file
include_vars:
file: "{{ allocations_file_path }}"
name: allocations
- 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 }}"
ironic_nodes: "{{ alloc.value }}"
ironic_hypervisor: "{{ alloc.key }}"
ironic_virtualenv_path: "{{ virtualenv_path }}"
ironic_python_upper_constraints_url: >-
{{ python_upper_constraints_url }}
loop: "{{ query('dict', allocations) }}"
loop_control:
loop_var: alloc