Performance: use import_tasks for register and bootstrap

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. In the case of the register.yml and bootstrap.yml
includes, all of the tasks in the included file use run_once: True.
The run_once flag improves performance at scale drastically, so
importing these tasks unconditionally will have a lower overhead than a
conditional include task.  It therefore makes sense to switch to use
import_tasks there.

See [1] for benchmarks of run_once.

[1] https://github.com/stackhpc/ansible-scaling/blob/master/doc/run-once.md

Change-Id: Ic67631ca3ea3fb2081a6f8978e85b1522522d40d
Partially-Implements: blueprint performance-improvements
This commit is contained in:
Mark Goddard 2020-07-07 17:14:37 +01:00
parent b685ac44e0
commit 496904d650
37 changed files with 74 additions and 144 deletions

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['aodh-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: aodh_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['aodh-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['barbican-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: barbican_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['barbican-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['blazar-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: blazar_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['blazar-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['ceilometer']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: ceilometer_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['ceilometer']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['cinder-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: cinder_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['cinder-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -41,6 +41,8 @@
hostname: "{{ influxdb_address }}"
port: "{{ influxdb_http_port }}"
database_name: "{{ cloudkitty_influxdb_name }}"
run_once: True
delegate_to: "{{ groups['cloudkitty-api'][0] }}"
when: cloudkitty_storage_backend == 'influxdb'
- import_tasks: bootstrap_service.yml

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['cloudkitty-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: cloudkitty_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['cloudkitty-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,11 +1,9 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['cyborg-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['cyborg-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,17 +1,14 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['designate-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: designate_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['designate-central']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers
- include_tasks: update_pools.yml
when: inventory_hostname == groups['designate-worker'][0]
- import_tasks: update_pools.yml

View File

@ -2,4 +2,5 @@
- name: Update DNS pools
become: true
command: docker exec -t designate_worker designate-manage pool update --file /etc/designate/pools.yaml
when: inventory_hostname == groups['designate-worker'][0]
run_once: True
delegate_to: "{{ groups['designate-worker'][0] }}"

View File

@ -12,6 +12,7 @@
run_once: True
delegate_to: "{{ groups['freezer-api'][0] }}"
when:
- freezer_database_backend == 'mariadb'
- not use_preconfigured_databases | bool
- name: Creating Freezer database user and setting permissions
@ -31,6 +32,7 @@
run_once: True
delegate_to: "{{ groups['freezer-api'][0] }}"
when:
- freezer_database_backend == 'mariadb'
- not use_preconfigured_databases | bool
- import_tasks: bootstrap_service.yml

View File

@ -1,17 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['freezer-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: freezer_dev_mode | bool
- include_tasks: bootstrap.yml
when: freezer_database_backend == 'mariadb' and inventory_hostname in groups['freezer-api']
- include_tasks: bootstrap_service.yml
when: inventory_hostname in groups['freezer-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,11 +1,9 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['gnocchi-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['gnocchi-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,6 +1,5 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['heat-api']
- import_tasks: register.yml
- import_tasks: config.yml
@ -8,8 +7,7 @@
when:
- heat_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['heat-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,8 +1,6 @@
---
- include_tasks: register.yml
when: enable_keystone | bool and
(inventory_hostname in groups['ironic-api'] or
inventory_hostname in groups['ironic-inspector'])
- import_tasks: register.yml
when: enable_keystone | bool
- import_tasks: config-host.yml
@ -11,10 +9,7 @@
- include_tasks: clone.yml
when: ironic_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['ironic-api'] or
inventory_hostname in groups['ironic-inspector'] or
inventory_hostname in groups['ironic-pxe']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,11 +1,9 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['karbor-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['karbor-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['magnum-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: magnum_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['magnum-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -2,13 +2,11 @@
- include_tasks: clone.yml
when: manila_dev_mode | bool
- include_tasks: register.yml
when: inventory_hostname in groups['manila-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['manila-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['masakari-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: masakari_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['masakari-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['mistral-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: mistral_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['mistral-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,13 +1,9 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['monasca-agent'] or
inventory_hostname in groups['monasca-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['monasca-api'] or
inventory_hostname in groups['monasca-grafana']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -30,8 +30,7 @@
- inventory_hostname != groups['monasca-grafana']|first
- monasca_grafana_differs['result']
- include_tasks: register.yml
when: inventory_hostname in groups['monasca-api']
- import_tasks: register.yml
- import_tasks: bootstrap_service.yml

View File

@ -1,6 +1,5 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['murano-api']
- import_tasks: register.yml
- import_tasks: config.yml
@ -8,8 +7,7 @@
when:
- murano_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['murano-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,6 +1,5 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['neutron-server']
- import_tasks: register.yml
- include_tasks: clone.yml
when: neutron_dev_mode | bool
@ -14,8 +13,7 @@
- enable_nova_fake | bool
- inventory_hostname in groups['compute']
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['neutron-server']
- import_tasks: bootstrap.yml
- name: Flush Handlers
meta: flush_handlers

View File

@ -1,6 +1,5 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['nova-api']
- import_tasks: register.yml
- import_tasks: config.yml

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['octavia-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: octavia_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['octavia-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['placement-api']
- import_tasks: register.yml
- include_tasks: clone.yml
when: placement_dev_mode | bool
- import_tasks: config.yml
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['placement-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['placement-api']
- import_tasks: register.yml
- include_tasks: clone.yml
when: placement_dev_mode | bool
- import_tasks: config.yml
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['placement-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['qinling-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: qinling_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['qinling-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['sahara-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: sahara_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['sahara-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['senlin-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: senlin_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['senlin-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['solum-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: solum_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['solum-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,6 +1,5 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['tacker-server']
- import_tasks: register.yml
- import_tasks: config.yml
@ -8,8 +7,7 @@
when:
- tacker_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['tacker-server']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['trove-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: trove_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['trove-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['vitrage-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: vitrage_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['vitrage-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['watcher-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: watcher_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['watcher-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers

View File

@ -1,14 +1,12 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['zun-api']
- import_tasks: register.yml
- import_tasks: config.yml
- include_tasks: clone.yml
when: zun_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['zun-api']
- import_tasks: bootstrap.yml
- name: Flush handlers
meta: flush_handlers