diff --git a/ansible/baremetal-compute-inspect.yml b/ansible/baremetal-compute-inspect.yml index 8b356c17a..9474d2b54 100644 --- a/ansible/baremetal-compute-inspect.yml +++ b/ansible/baremetal-compute-inspect.yml @@ -8,7 +8,7 @@ - name: Ensure dependencies are installed and the virtual environment is activated hosts: controllers[0] - gather_facts: False + gather_facts: true vars: venv: "{{ virtualenv_path }}/shade" roles: diff --git a/ansible/baremetal-compute-manage.yml b/ansible/baremetal-compute-manage.yml index 326840171..7f9d1f7ef 100644 --- a/ansible/baremetal-compute-manage.yml +++ b/ansible/baremetal-compute-manage.yml @@ -8,7 +8,7 @@ - name: Ensure baremetal compute nodes are available in ironic hosts: controllers[0] - gather_facts: False + gather_facts: true vars: venv: "{{ virtualenv_path }}/shade" roles: diff --git a/ansible/baremetal-compute-provide.yml b/ansible/baremetal-compute-provide.yml index 2d578e0f2..b51a37c5b 100644 --- a/ansible/baremetal-compute-provide.yml +++ b/ansible/baremetal-compute-provide.yml @@ -8,7 +8,7 @@ - name: Ensure baremetal compute nodes are available in ironic hosts: controllers[0] - gather_facts: False + gather_facts: true vars: venv: "{{ virtualenv_path }}/shade" roles: diff --git a/ansible/baremetal-compute-rename.yml b/ansible/baremetal-compute-rename.yml index 5fdc4958e..049cba620 100644 --- a/ansible/baremetal-compute-rename.yml +++ b/ansible/baremetal-compute-rename.yml @@ -54,5 +54,8 @@ # be respected when using delegate_to. ansible_host: "{{ hostvars[controller_host].ansible_host | default(controller_host) }}" ipmi_address: "{{ hostvars[inventory_hostname].ipmi_address }}" - node: "{{ (nodes.stdout | from_json) | selectattr('Driver Info.ipmi_address', 'equalto', ipmi_address) | first }}" - when: node['Name'] != inventory_hostname + matching_nodes: "{{ (nodes.stdout | from_json) | selectattr('Driver Info.ipmi_address', 'defined') | selectattr('Driver Info.ipmi_address', 'equalto', ipmi_address) | list }}" + node: "{{ matching_nodes | first }}" + when: + - matching_nodes | length > 0 + - node['Name'] != inventory_hostname