kolla-ansible/ansible/roles/nova-cell/tasks/deploy.yml
Mark Goddard b685ac44e0 Performance: replace unconditional include_tasks with import_tasks
Including tasks has a performance penalty when compared with importing
tasks. If the include has a condition associated with it, then the
overhead of the include may be lower than the overhead of skipping all
imported tasks. For unconditionally included tasks, switching to
import_tasks provides a clear benefit.

Benchmarking of include vs. import is available at [1].

This change switches from include_tasks to import_tasks where there is
no condition applied to the include.

[1] https://github.com/stackhpc/ansible-scaling/blob/master/doc/include-and-import.md#task-include-and-import

Partially-Implements: blueprint performance-improvements

Change-Id: Ia45af4a198e422773d9f009c7f7b2e32ce9e3b97
2020-08-28 16:12:03 +00:00

37 lines
1.2 KiB
YAML

---
- include_tasks: clone.yml
when: nova_dev_mode | bool
- import_tasks: config-host.yml
- import_tasks: config.yml
- include_tasks: config-nova-fake.yml
when:
- enable_nova_fake | bool
- inventory_hostname in groups[nova_cell_compute_group]
- name: Flush handlers
meta: flush_handlers
- include_tasks: discover_computes.yml
vars:
# List of virtualised compute hypervisors in this Ansible play batch.
virt_computes_in_batch: >-
{{ groups[nova_cell_compute_group] |
intersect(ansible_play_batch) |
list }}
# List of iroinc compute hosts in this Ansible play batch.
ironic_computes_in_batch: >-
{{ (groups[nova_cell_compute_ironic_group] |
intersect(ansible_play_batch) |
list)
if nova_cell_services['nova-compute-ironic'].enabled | bool else [] }}
all_computes_in_batch: "{{ virt_computes_in_batch + ironic_computes_in_batch }}"
when:
# Run discovery when one or more compute hosts are in the Ansible batch,
# and there is a cell conductor in the inventory to delegate to.
- all_computes_in_batch | length > 0
- inventory_hostname == all_computes_in_batch[0]
- groups[nova_cell_conductor_group] | length > 0