Use dynamic import for conditional task imports

When task import condition is false, we need to use include instead
of import, since this allows not running through all tasks and
reduce amount of skipped tasks for such deployments.

Change-Id: I4b51290b94b5b4b54b111d197688f65129a4f5ad
This commit is contained in:
Dmitriy Rabotyagov 2021-04-23 10:16:43 +03:00
parent 370ea30b99
commit 53870c390e
2 changed files with 37 additions and 16 deletions

View File

@ -77,11 +77,15 @@
- common-mq
- octavia-config
- import_tasks: octavia_certs.yml
- include_tasks: octavia_certs.yml
args:
apply:
tags:
- octavia-config
run_once: true
when: octavia_generate_certs | bool
tags:
- octavia-config
- always
- name: Gather variables for installation method
include_vars: "{{ octavia_install_method }}_install.yml"
@ -97,9 +101,13 @@
- octavia-install
- include_tasks: octavia_certs_distribute.yml
args:
apply:
tags:
- octavia-config
when: octavia_generate_certs | bool
tags:
- octavia-config
- always
- name: Import uwsgi role
import_role:
@ -165,14 +173,18 @@
tags:
- octavia-install
- import_tasks: octavia_mgmt_network.yml
- include_tasks: octavia_mgmt_network.yml
args:
apply:
tags:
- octavia-install
- octavia-config
when:
- octavia_neutron_management_network_uuid is not defined
- octavia_neutron_management_network_name is defined
- _octavia_is_first_play_host
tags:
- octavia-install
- octavia-config
- always
- import_tasks: octavia_security_group.yml
when:
@ -181,18 +193,26 @@
- octavia-install
- include_tasks: octavia_keypair.yml
args:
apply:
tags:
- octavia-config
when:
- _octavia_is_first_play_host
tags:
- octavia-config
- always
- import_tasks: octavia_flavor_create.yml
- include_tasks: octavia_flavor_create.yml
args:
apply:
tags:
- octavia-install
- octavia-config
when:
- _octavia_is_first_play_host
- octavia_nova_flavor_uuid is not defined
tags:
- octavia-install
- octavia-config
- always
- import_tasks: octavia_post_install.yml
tags:
@ -211,11 +231,16 @@
- octavia-config
- octavia-policy-override
- import_tasks: octavia_amp_image.yml
- include_tasks: octavia_amp_image.yml
args:
apply:
tags:
- octavia-config
when:
- _octavia_is_first_play_host
- octavia_download_artefact | bool
tags:
- octavia-config
- always
- name: Flush handlers
meta: flush_handlers

View File

@ -29,8 +29,6 @@
state: directory
mode: "0750"
owner: "{{ octavia_amp_image_path_owner }}"
when:
- octavia_download_artefact | bool
- name: Download image from artefact server
get_url:
@ -39,8 +37,6 @@
retries: 10
delay: 10
register: octavia_download_result
when:
- octavia_download_artefact | bool
- name: Replace existing image with new one
when: