Merge "Delegate compute wait tasks to service_setup_host"

This commit is contained in:
Zuul
2023-05-09 12:14:08 +00:00
committed by Gerrit Code Review
2 changed files with 18 additions and 19 deletions

View File

@@ -316,11 +316,7 @@
- name: Flush handlers - name: Flush handlers
meta: flush_handlers meta: flush_handlers
# We delegate this back to the conductor because that is
# where we want to isolate the clouds.yaml configuration,
# rather than have it implemented on all compute nodes.
- import_tasks: nova_compute_wait.yml - import_tasks: nova_compute_wait.yml
delegate_to: "{{ nova_conductor_setup_host }}"
when: when:
- "nova_services['nova-compute']['group'] in group_names" - "nova_services['nova-compute']['group'] in group_names"
- "nova_discover_hosts_in_cells_interval | int < 1" - "nova_discover_hosts_in_cells_interval | int < 1"

View File

@@ -13,34 +13,37 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Implement openrc/clouds.yaml - name: Ensure compute is discovered
include_role: block:
name: "openstack_openrc"
- name: Set the delegated task facts
set_fact:
_wait_nova_bin: "{{ hostvars[nova_conductor_setup_host]['nova_bin'] | default(nova_bin) }}"
- block:
- name: Wait for the nova-compute service to initialize - name: Wait for the nova-compute service to initialize
command: "{{ _wait_nova_bin }}/openstack --os-cloud default compute service list --service nova-compute --format value --column Host" delegate_to: "{{ nova_service_setup_host }}"
changed_when: false vars:
ansible_python_interpreter: "{{ nova_service_setup_host_python_interpreter }}"
openstack.cloud.compute_service_info:
cloud: default
binary: "nova-compute"
host: "{{ compute_host_to_wait_for }}"
register: _compute_host_list register: _compute_host_list
retries: 10 retries: 10
delay: 5 delay: 5
until: "compute_host_to_wait_for in _compute_host_list.stdout_lines" until: "_compute_host_list.compute_services"
rescue: rescue:
- name: Restart nova-compute service - name: Restart nova-compute service
service: service:
name: "{{ nova_services['nova-compute']['service_name'] }}" name: "{{ nova_services['nova-compute']['service_name'] }}"
state: restarted state: restarted
delegate_to: "{{ compute_host_to_wait_for }}"
- name: Wait for the nova-compute service to initialize - name: Wait for the nova-compute service to initialize
command: "{{ _wait_nova_bin }}/openstack --os-cloud default compute service list --service nova-compute --format value --column Host" delegate_to: "{{ nova_service_setup_host }}"
vars:
ansible_python_interpreter: "{{ nova_service_setup_host_python_interpreter }}"
openstack.cloud.compute_service_info:
cloud: default
binary: "nova-compute"
host: "{{ compute_host_to_wait_for }}"
changed_when: false changed_when: false
register: _compute_host_list register: _compute_host_list
retries: 10 retries: 10
delay: 5 delay: 5
until: "compute_host_to_wait_for in _compute_host_list.stdout_lines" until: "_compute_host_list.compute_services"