From 2a6336a742c05e2e6c5fd30a21cd1989823773a1 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Wed, 11 Dec 2019 21:39:44 -0500 Subject: [PATCH] Execute deploy_steps_tasks per step Instead of including the entire deploy_steps_tasks.yaml tasks file for each role at each step, use the per-step files and only if they exist. This cuts down on the amount of time that ansible has to spend skipping tasks that don't get run at a certain step, which can be significant at scale. Change-Id: I06ee04b9b47226433f25e3cff08c461462a907d9 Depends-On: Id5fdb4dd1a6290d1097d2d81523161c87ab6d4dd --- common/deploy-steps-tasks-step-0.j2.yaml | 15 +++++++++++++-- common/deploy-steps.j2 | 13 +++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/common/deploy-steps-tasks-step-0.j2.yaml b/common/deploy-steps-tasks-step-0.j2.yaml index 1f78d9a043..5178b87164 100644 --- a/common/deploy-steps-tasks-step-0.j2.yaml +++ b/common/deploy-steps-tasks-step-0.j2.yaml @@ -1,4 +1,6 @@ - name: Deploy step tasks for step 0 + delegate_to: localhost + run_once: true debug: msg: Use --start-at-task 'Deploy step tasks for step 0' to resume from this task when: "tripleo_minor_update is not defined or tripleo_minor_update != 'true'" @@ -13,6 +15,15 @@ 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 %} -- include_tasks: {{role.name}}/deploy_steps_tasks.yaml - when: tripleo_role_name == '{{role.name}}' +- name: Check for {{role.name}}/deploy_steps_tasks_step0.yaml + delegate_to: localhost + run_once: true + become: false + stat: + path: "{{ '{{' }} playbook_dir ~ '/' ~ '{{role.name}}' ~ '/' ~ 'deploy_steps_tasks_step0.yaml' {{ '}}' }}" + register: tasks_stat +- include_tasks: {{role.name}}/deploy_steps_tasks_step0.yaml + when: + - tripleo_role_name == '{{role.name}}' + - tasks_stat.stat.exists {%- endfor %} diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index 949448c268..c0ed5ef9fe 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -782,8 +782,17 @@ outputs: debug: msg: Use --start-at-task 'Deploy step tasks for {{step}}' to resume from this task {%- for role in roles %} - - include_tasks: {{role.name}}/deploy_steps_tasks.yaml - when: tripleo_role_name == '{{role.name}}' + - name: Check for {{role.name}}/deploy_steps_tasks_step{{step}}.yaml + delegate_to: localhost + become: false + run_once: true + stat: + path: "{{ '{{' }} playbook_dir ~ '/' ~ '{{role.name}}' ~ '/' ~ 'deploy_steps_tasks_step{{step}}.yaml' {{ '}}' }}" + register: tasks_stat + - include_tasks: {{role.name}}/deploy_steps_tasks_step{{step}}.yaml + when: + - tripleo_role_name == '{{role.name}}' + - tasks_stat.stat.exists {%- endfor %} tags: - overcloud