From ceb2d45abda69244a3e5bf1dbd78e3f7d403d2f6 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 13 May 2025 18:27:10 +0200 Subject: [PATCH] Use dynamic include instead of static imports for conditional tasks When tasks are needed conditionally it's better to include them to avoid all skipped actions inside of the them, which also consume time. Change-Id: I0728383786d6f2282888fc1bf6ddace7773f2e40 --- tasks/main.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index dde991e4..ddde2654 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -123,8 +123,12 @@ - glance-config - post-install -- name: Importing glance_db_sync tasks - ansible.builtin.import_tasks: glance_db_sync.yml +- name: Including glance_db_sync tasks + ansible.builtin.include_tasks: glance_db_sync.yml + args: + apply: + tags: + - glance-config when: - "_glance_is_first_play_host" tags: @@ -178,9 +182,12 @@ - glance-config - uwsgi -- name: Import ceph_client role - ansible.builtin.import_role: +- name: Include ceph_client role + ansible.builtin.include_role: name: ceph_client + apply: + tags: + - ceph vars: openstack_service_system_user: "{{ glance_system_user_name }}" openstack_service_venv_bin: "{{ (glance_install_method == 'source') | ternary(glance_bin, '') }}"