Fixes for baremetal compute commands

Gather facts prior to using the stackhpc.os-shade role. This is required
following a recent change in that role to reference the ansible_user_uid and
ansible_user_gid facts.

Allow 'kayobe baremetal compute rename' command to ignore compute nodes in the
ansible inventory but not found in ironic.

Change-Id: I75a2f0dd0192e41de7b91376bb32b4149df04a60
TrivialFix
This commit is contained in:
Mark Goddard 2018-08-17 13:44:42 +01:00
parent 34e410dd46
commit 21ce37e698
4 changed files with 8 additions and 5 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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