Use include_tasks instead of import_tasks

include_tasks is dynamic and the tasks are either included (or not) at
runtime. This has the advantage that if a "when" keyword excludes the
include_tasks, then all the tasks are excluded as a group.

This is opposed to import_tasks which happen at playbook parse time. The
"when" keyword is inherited by each individual task that was imported.

While the two are functionally equivalent for these use cases,
import_tasks ends up being much slower, since ansible then has to
compute a much larger set of tasks to skip at runtime. Using
include_tasks is much faster, even at small scale (~50 hosts).

Conflicts:
    common/deploy-steps-tasks-step-0.j2.yaml
    common/deploy-steps.j2

Change-Id: I2db81d39b3294aa2784a340562f10fd9bf3fe9ee
(cherry picked from commit 6f8b2db26a)
This commit is contained in:
James Slagle 2019-12-05 11:00:55 -05:00 committed by Luke Short
parent bdc5508f70
commit f19e2c7144
1 changed files with 2 additions and 2 deletions

View File

@ -496,7 +496,7 @@ outputs:
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- import_tasks: deploy_steps_tasks_step_0.yaml
- include_tasks: deploy_steps_tasks_step_0.yaml
tags:
- overcloud
- deploy_steps
@ -836,7 +836,7 @@ outputs:
stat:
path: /var/lib/tripleo-config/container-startup-config-1.json
register: container_startup_configs_json_stat
- import_tasks: common_deploy_steps_tasks.yaml
- include_tasks: common_deploy_steps_tasks.yaml
when: (deploy_identifier is defined and deploy_identifier != "" and deploy_identifier is not none) or
(container_startup_configs_json_stat is defined and not container_startup_configs_json_stat.stat.exists)
tags: