--- - 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') # This is useful to get a uniquely generated temporary path. - name: Create temporary file for pip requirements tempfile: register: req_file - name: Copy requirements file to temporary location copy: src: requirements.txt dest: "{{ req_file.path }}" - name: Ensure Python requirements are installed pip: requirements: "{{ req_file.path }}" extra_args: >- -c {{ ironic_python_upper_constraints_url }} virtualenv: "{{ ironic_virtualenv_path }}" # This command will return the UUIDs, regardless of whether # ironic_deploy_kernel and ironic_deploy_ramdisk are image UUIDs or names. - name: Get OpenStack deployment image UUIDs command: >- '{{ ironic_virtualenv_path }}/bin/openstack' image show '{{ item }}' --format value --column id loop: - "{{ ironic_deploy_kernel }}" - "{{ ironic_deploy_ramdisk }}" # ironic_deploy_kernel/ramdisk default to none. We don't need to know them # for enrolment to continue. when: - item is not none - item != "" register: deploy_image_ids changed_when: false - name: Configure Ironic node enrolment include_tasks: node.yml vars: node: "{{ ironic_node }}" ipmi_port: >- {{ hostvars[ironic_hypervisor].ipmi_port_range_start + port_offset }} ironic_deploy_kernel_uuid: >- {{ deploy_image_ids.results.0.stdout | default(ironic_deploy_kernel) }} ironic_deploy_ramdisk_uuid: >- {{ deploy_image_ids.results.1.stdout | default(ironic_deploy_ramdisk) }} loop: "{{ ironic_nodes | sort(attribute='name') }}" loop_control: loop_var: ironic_node index_var: port_offset # If no ironic_config options were set, this means that enrolment should not # be performed. when: "'ironic_config' in ironic_node"