Use include instead of import for conditional tasks

When import is used ansible loads imported role or tasks which
results in plenty of skipped tasks which also consume time. With
includes ansible does not try to load play so time not wasted on
skipping things.

Depends-On: https://review.opendev.org/c/openstack/ansible-role-uwsgi/+/880344
Change-Id: I47c6623e166254802ed0b479b2353c5f2ceb5cfa
This commit is contained in:
Dmitriy Rabotyagov 2023-02-23 18:41:22 +01:00 committed by Dmitriy Rabotyagov
parent a5808248cb
commit 5d310c69fd
1 changed files with 20 additions and 9 deletions

View File

@ -103,17 +103,15 @@
tags:
- always
- import_tasks: nova_virt_detect.yml
- include_tasks: nova_virt_detect.yml
when:
- nova_virt_type is not defined
tags:
- always
- nova-config
- import_tasks: nova_mdev_detect.yml
tags:
- always
- nova-config
- import_tasks: nova_pre_install.yml
tags:
@ -204,11 +202,15 @@
tags:
- always
- import_tasks: nova_db_setup.yml
- include_tasks: nova_db_setup.yml
args:
apply:
tags:
- nova-config
when:
- _nova_is_first_play_host
tags:
- nova-config
- always
- name: Import uwsgi role
import_role:
@ -216,6 +218,8 @@
vars:
uwsgi_services: "{{ uwsgi_nova_services }}"
uwsgi_install_method: "{{ nova_install_method }}"
when:
- uwsgi_nova_services | length > 0
tags:
- nova-config
- uwsgi
@ -253,16 +257,23 @@
- nova-config
- systemd-service
- import_tasks: nova_compute.yml
- include_tasks: nova_compute.yml
args:
apply:
tags:
- nova-compute
when:
- nova_virt_type != 'ironic'
- "nova_services['nova-compute']['group'] in group_names"
tags:
- nova-compute
- always
- name: Include ceph_client role
import_role:
include_role:
name: ceph_client
apply:
tags:
- ceph
vars:
openstack_service_system_user: "{{ nova_system_user_name }}"
openstack_service_venv_bin: "{{ (nova_install_method == 'source') | ternary(nova_bin, '') }}"
@ -271,7 +282,7 @@
- nova_services['nova-compute']['group'] in group_names
- (nova_rbd_inuse | bool) or (nova_glance_rbd_inuse | bool)
tags:
- ceph
- always
- name: Flush handlers
meta: flush_handlers