Add named debug tasks to each play

Named debug ansible tasks have been added to the plays that get
generated in deploy_steps_playbook.yaml (from common/deploy-steps.j2).
The explicitly named tasks allow for using ansible-playbook's
--start-at-task option to resume a deployment from the start of a given
play.

For example, this could be used to resume a deployment with:
ansible-playbook ... --start-at-task "Overcloud common deploy step tasks 3" ...

Previously this was not possible since many of the tasks that got
generated in common_deploy_steps_tasks.yaml used an ansible variable in
the name, which is not resolved until runtime, so --start-at-task is
ignored.

Change-Id: If40a5ecaacf8c74c98775eb6bde05d967694f640
This commit is contained in:
James Slagle 2019-02-13 14:23:26 -05:00
parent 7aa95e75e3
commit 7859700354
2 changed files with 36 additions and 0 deletions

View File

@ -453,6 +453,12 @@ outputs:
name: Common roles for TripleO servers
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
any_errors_fatal: yes
# pre_tasks run before any roles in a play, so we use it for the
# named debug task for --start-at-task.
pre_tasks:
- name: Common roles for TripleO servers
debug:
msg: Use --start-at-task "Common roles for TripleO servers" to resume from this task
roles:
- tripleo-bootstrap
- tripleo-ssh-known-hosts
@ -476,6 +482,9 @@ outputs:
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- name: Overcloud deploy step tasks for step 0
debug:
msg: Use --start-at-task "Overcloud deploy step tasks for step 0" to resume from this task
- name: Create /var/lib/container-puppet
no_log: True
file: path=/var/lib/container-puppet state=directory setype=svirt_sandbox_file_t selevel=s0 recurse=true
@ -537,6 +546,9 @@ outputs:
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
any_errors_fatal: yes
tasks:
- name: Server deployments
debug:
msg: Use --start-at-task "Server deployments" to resume from this task
- include_tasks: deployments.yaml
vars:
force: false
@ -657,6 +669,9 @@ outputs:
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- name: Host prep steps
debug:
msg: Use --start-at-task "{{role.name}} Host prep steps" to resume from this task
- import_tasks: {{role.name}}/host_prep_tasks.yaml
tags:
- overcloud
@ -683,6 +698,9 @@ outputs:
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- name: External deployment step {{step}}
debug:
msg: Use --start-at-task "External deployment step {{step}}" to resume from this task
- import_tasks: external_deploy_steps_tasks.yaml
tags:
- external
@ -715,6 +733,9 @@ outputs:
dest: /etc/puppet/hieradata/config_step.json
force: true
mode: '0600'
- name: Overcloud deploy step tasks for {{step}}
debug:
msg: Use --start-at-task "Overcloud deploy step tasks for {{step}}" to resume from this task
{%- for role in roles %}
- import_tasks: {{role.name}}/deploy_steps_tasks.yaml
when: tripleo_role_name == '{{role.name}}'
@ -741,6 +762,9 @@ outputs:
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- name: Overcloud common deploy step tasks {{step}}
debug:
msg: Use --start-at-task "Overcloud common deploy step tasks {{step}}" to resume from this task
- name: Check if /var/lib/tripleo-config/container-startup-config-1.json already exists
stat:
path: /var/lib/tripleo-config/container-startup-config-1.json
@ -759,6 +783,9 @@ outputs:
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
any_errors_fatal: yes
tasks:
- name: Server Post Deployments
debug:
msg: Use --start-at-task "Server Post Deployments" to resume from this task
- include_tasks: deployments.yaml
vars:
force: false
@ -784,6 +811,9 @@ outputs:
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- name: External deployment Post Deploy tasks
debug:
msg: Use --start-at-task "External deployment Post Deploy tasks" to resume from this task
- import_tasks: external_post_deploy_steps_tasks.yaml
tags:
- external

View File

@ -0,0 +1,6 @@
---
features:
- Named debug ansible tasks have been added to the plays that get generated
in deploy_steps_playbook.yaml (from common/deploy-steps.j2). The explicitly
named tasks allow for using ansible-playbook's --start-at-task option to
resume a deployment from the start of a given play.