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.

Closes-Bug: #1842410

Change-Id: I51a148cdc5538d5a1106d58d227d361d1e6f9e19
This commit is contained in:
Sergii Golovatiuk 2019-08-30 23:25:11 +02:00
parent bc61ad8873
commit 74a1cd7d13

View File

@ -954,13 +954,15 @@ outputs:
include_vars: "{{ '{{ ' }} playbook_dir {{ ' }}' }}/group_vars/overcloud.json"
tags:
- facts
{%- 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
@ -971,24 +973,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
@ -999,14 +1001,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:
- external
- external_deploy_steps
- step{{step}}
{%- endfor %}
pre_upgrade_rolling_steps_tasks: |
{%- for role in roles %}
- import_tasks: {{role.name}}/pre_upgrade_rolling_tasks.yaml
@ -1262,8 +1262,9 @@ outputs:
include_vars: "{{ '{{ ' }} playbook_dir {{ ' }}' }}/group_vars/overcloud.json"
tags:
- facts
{%- 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
@ -1271,6 +1272,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
@ -1282,19 +1284,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
@ -1302,6 +1303,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
@ -1313,14 +1315,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 %}
scale_steps_tasks: {get_attr: [ScaleTasks, value]}
scale_playbook:
str_replace: