kolla-ansible/ansible/roles/nova-cell/tasks/discover_computes.yml
Mark Goddard 832989d0a6 nova: use any_errors_fatal for once-per-cell tasks
We run some nova tasks once per cell, using a condition to match a
single host in the cell. In other similar tasks, we use run_once, which
will fail all hosts if the task fails. Typically these tasks are
critical, and that is desirable. However, with the approach used in
nova-cell to support multiple cells, if a once-per-cell task fails, then
other hosts will continue to execute, which could lead to unexpected
results.

This change adds any_errors_fatal to the plays or blocks that run these
tasks.

Closes-Bug: #1948694

Change-Id: I2a5871ccd4e8198171ef3239ce95f475f3e4b051
2022-04-22 10:37:25 +00:00

24 lines
759 B
YAML

---
# Discover compute hosts for a cell.
- block:
- import_tasks: get_cell_settings.yml
- name: Fail if cell settings not found
fail:
msg: >-
Unable to find settings for {{ nova_cell_name or 'the default cell' }}.
when: not nova_cell_settings
# TODO(yoctozepto): no need to do --by-service if ironic not used
- name: Discover nova hosts
become: true
command: >
docker exec nova_conductor nova-manage cell_v2 discover_hosts --by-service --cell_uuid {{ nova_cell_settings.cell_uuid }}
changed_when: False
# Delegate to a cell conductor.
delegate_to: "{{ groups[nova_cell_conductor_group][0] }}"
# Fail all hosts if any of these once-per-cell tasks fail.
any_errors_fatal: true