Use node FQDN for nova-restore-compute-id

Hypervisor list for Nova get's populated with node FQDNs, which might
be completely different then nodename.

This is also reproducible in AIO, where ansible_facts['nodename'] is
`aio1`, while ansible_facts['fqdn'] is `aio1.openstack.local`.
And the fqdn is defined in hypervisor listing.

Since there could be a confusion in hostname/nodename/fqdn from
deployment to deployment, we make the fact variable configurable.

Related-Bug: #2081741
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-openstack_hosts/+/930272
Change-Id: If43d721abb978d305abba8ee01d6de2ed2bf2553
This commit is contained in:
Dmitriy Rabotyagov 2024-09-24 13:13:29 +02:00
parent 9632ec89d7
commit d70218855e

View File

@ -3,6 +3,7 @@
hosts: nova_compute
vars:
nova_compute_id_file: /var/lib/nova/compute_id
nova_hypervisor_fact_name: "{{ ansible_facts['fqdn'] }}"
handlers:
- name: Restart nova
@ -30,7 +31,7 @@
- name: Register hypervisors fact
ansible.builtin.set_fact:
nova_hv: "{{ nova_hypervisors.stdout | from_json | selectattr('Hypervisor Hostname', 'eq', ansible_facts['nodename']) }}"
nova_hv: "{{ nova_hypervisors.stdout | from_json | selectattr('Hypervisor Hostname', 'eq', nova_hypervisor_fact_name) }}"
- name: Place node UUID to the expected location
ansible.builtin.copy: