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

View File

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