diff --git a/ansible/baremetal-compute-inspect.yml b/ansible/baremetal-compute-inspect.yml index 8b356c17a3cecd753f076c61dcaf8818a946a346..9474d2b546c01d660fbfd5660c0182605a88e71d 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 326840171bcf24c49ece461d1941b516f7d31e9a..7f9d1f7efd99dcf156cc8635de8c7163ff952a0b 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 2d578e0f2d1ce5ee18c1ddd6810e1bd0c26ffcdb..b51a37c5b621c673db0a06d00c8de5739e9fdeac 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 5fdc4958ed6d2cdc43440f67c1c80cebb44769ad..049cba6202dd75d16250adfc37bb31eb231bf55f 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