Replace include_tasks with import_tasks

There are places when we have include_tasks in nested tasks. It means
that -t "tag_from_nested_task" won't work as all nested tasks will need
either "always" tag or should be "import_tasks" instead.

This patch replaces include_tasks with import_tasks for External steps
allowing to run

openstack overcloud external-update run --tags tag_from_nested_task
openstack overcloud external-upgrade run --tags tag_from_nested_task

without hacking all nested tasks.

cherry-pick not 100% clean, required to resolve conflicts due to big
difference between master and stable/stein.

Closes-Bug: #1842410

(manually cherry-picked from commit 74a1cd7d13)

Change-Id: I51a148cdc5538d5a1106d58d227d361d1e6f9e19
This commit is contained in:
Sergii Golovatiuk 2019-08-30 23:25:11 +02:00
parent b33b839125
commit 1110b75378
1 changed files with 25 additions and 25 deletions

View File

@ -607,13 +607,15 @@ outputs:
- include_vars: global_vars.yaml
tags:
- always
{%- for step in range(external_update_steps_max) %}
- hosts: DEPLOY_SOURCE_HOST
name: External update steps
name: External update step {{step}}
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
any_errors_fatal: yes
become: false
vars:
bootstrap_server_id: BOOTSTRAP_SERVER_ID
step: '{{step}}'
deploy_identifier: DEPLOY_IDENTIFIER
enable_debug: ENABLE_DEBUG
enable_puppet: ENABLE_PUPPET
@ -624,24 +626,24 @@ outputs:
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- include_tasks: external_update_steps_tasks.yaml
with_sequence: start=0 end={{external_update_steps_max-1}}
loop_control:
loop_var: step
tags: always
- import_tasks: external_update_steps_tasks.yaml
tags:
- step{{step}}
- external
- external_update_steps
{%- endfor %}
{%- for step in range(1,deploy_steps_max) %}
# putting both update and deploy tasks in the same
# playbook allows influencing the deploy tasks by
# variables "exported" from update tasks
- hosts: DEPLOY_SOURCE_HOST
name: External deploy steps
name: External deploy step {{step}}
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
any_errors_fatal: yes
become: false
vars:
bootstrap_server_id: BOOTSTRAP_SERVER_ID
step: '{{step}}'
deploy_identifier: DEPLOY_IDENTIFIER
enable_debug: ENABLE_DEBUG
enable_puppet: ENABLE_PUPPET
@ -652,14 +654,12 @@ outputs:
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- include_tasks: external_deploy_steps_tasks.yaml
with_sequence: start=1 end={{deploy_steps_max-1}}
loop_control:
loop_var: step
tags: always
- import_tasks: external_deploy_steps_tasks.yaml
tags:
- step{{step}}
- external
- external_deploy_steps
{%- endfor %}
pre_upgrade_rolling_steps_tasks: |
{%- for role in roles %}
- import_tasks: {{role.name}}/pre_upgrade_rolling_tasks.yaml
@ -820,8 +820,9 @@ outputs:
- include_vars: global_vars.yaml
tags:
- always
{%- for step in range(external_upgrade_steps_max) %}
- hosts: DEPLOY_SOURCE_HOST
name: External upgrade
name: External upgrade step {{step}}
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
any_errors_fatal: yes
become: false
@ -829,6 +830,7 @@ outputs:
# Explicit ansible_python_interpreter to allow connecting
# to different OS releases (EL7/8) while using delegate_to.
ansible_python_interpreter: /usr/libexec/platform-python
step: '{{step}}'
bootstrap_server_id: BOOTSTRAP_SERVER_ID
deploy_identifier: DEPLOY_IDENTIFIER
enable_debug: ENABLE_DEBUG
@ -840,19 +842,18 @@ outputs:
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- include_tasks: external_upgrade_steps_tasks.yaml
with_sequence: start=0 end={{external_upgrade_steps_max-1}}
loop_control:
loop_var: step
tags: always
- import_tasks: external_upgrade_steps_tasks.yaml
tags:
- step{{step}}
- external
- external_upgrade_steps
{%- endfor %}
{%- for step in range(1,deploy_steps_max) %}
# putting both upgrade and deploy tasks in the same
# playbook allows influencing the deploy tasks by
# variables "exported" from upgrade tasks
- hosts: DEPLOY_SOURCE_HOST
name: External deploy steps
name: External deploy step {{step}}
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
any_errors_fatal: yes
become: false
@ -860,6 +861,7 @@ outputs:
# Explicit ansible_python_interpreter to allow connecting
# to different OS releases (EL7/8) while using delegate_to.
ansible_python_interpreter: /usr/libexec/platform-python
step: '{{step}}'
bootstrap_server_id: BOOTSTRAP_SERVER_ID
deploy_identifier: DEPLOY_IDENTIFIER
enable_debug: ENABLE_DEBUG
@ -871,14 +873,12 @@ outputs:
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- include_tasks: external_deploy_steps_tasks.yaml
with_sequence: start=1 end={{deploy_steps_max-1}}
loop_control:
loop_var: step
tags: always
tags:
- import_tasks: external_deploy_steps_tasks.yaml
tags:
- step{{step}}
- external
- external_deploy_steps
{%- endfor %}
fast_forward_upgrade_playbook:
str_replace:
params: