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). Change-Id: I2db81d39b3294aa2784a340562f10fd9bf3fe9ee
This commit is contained in:
parent
9f4832fcc4
commit
6f8b2db26a
|
@ -13,6 +13,6 @@
|
|||
copy: src=container_puppet_script.yaml dest=/var/lib/container-puppet/container-puppet.sh force=yes mode=0755 setype=container_file_t
|
||||
|
||||
{%- for role in roles %}
|
||||
- import_tasks: {{role.name}}/deploy_steps_tasks.yaml
|
||||
- include_tasks: {{role.name}}/deploy_steps_tasks.yaml
|
||||
when: tripleo_role_name == '{{role.name}}'
|
||||
{%- endfor %}
|
||||
|
|
|
@ -513,7 +513,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
|
||||
|
@ -772,7 +772,7 @@ outputs:
|
|||
debug:
|
||||
msg: Use --start-at-task 'Deploy step tasks for {{step}}' to resume from this task
|
||||
{%- for role in roles %}
|
||||
- import_tasks: {{role.name}}/deploy_steps_tasks.yaml
|
||||
- include_tasks: {{role.name}}/deploy_steps_tasks.yaml
|
||||
when: tripleo_role_name == '{{role.name}}'
|
||||
{%- endfor %}
|
||||
tags:
|
||||
|
@ -835,7 +835,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:
|
||||
|
|
Loading…
Reference in New Issue