Add deploy_steps_tasks interface

This allows per-step ansible tasks to be run on the nodes when using
the config download mechanism, e.g adding the following to a service
template will create /tmp/testperstep populated for every step.

     deploy_steps_tasks:
        - name: Test something happens each step
          lineinfile:
            path: /tmp/testperstep
            create: true
            line: "{{step}} step happened"

Change-Id: Ic34f5c48736b6340a1cfcea614b05e33e2fce040
This commit is contained in:
Steven Hardy 2017-11-22 18:37:39 +00:00 committed by Juan Antonio Osorio Robles
parent f253c0d08d
commit 0524c86353
3 changed files with 37 additions and 3 deletions

View File

@ -378,7 +378,7 @@ outputs:
RoleConfig:
description: Mapping of config data for all roles
value:
deploy_steps_tasks: {get_file: deploy-steps-tasks.yaml}
common_deploy_steps_tasks: {get_file: deploy-steps-tasks.yaml}
deploy_steps_playbook:
str_replace:
params:
@ -438,14 +438,32 @@ outputs:
- external
- external_deploy_steps
- hosts: overcloud
name: Overcloud deployment step {{step}}
name: Overcloud deploy step tasks for {{step}}
gather_facts: no
any_errors_fatal: yes
# FIXME(shardy) - it would be nice to use strategy: free to
# allow the tasks per-step to run in parallel on each role,
# but that doesn't work with any_errors_fatal: yes
vars:
bootstrap_server_id: BOOTSTRAP_SERVER_ID
step: '{{step}}'
tasks:
{%- for role in roles %}
- include: {{role.name}}/deploy_steps_tasks.yaml
when: role_name == '{{role.name}}'
{%- endfor %}
tags:
- overcloud
- deploy_steps
- hosts: overcloud
name: Overcloud common deploy step tasks {{step}}
gather_facts: no
any_errors_fatal: yes
vars:
bootstrap_server_id: BOOTSTRAP_SERVER_ID
step: '{{step}}'
tasks:
- include: deploy_steps_tasks.yaml
- include: common_deploy_steps_tasks.yaml
tags:
- overcloud
- deploy_steps

View File

@ -208,6 +208,16 @@ resources:
expression: coalesce($.data.role_data, []).where($ != null).select($.get('workflow_tasks')).where($ != null).reduce($1.mergeWith($2), {})
data: {role_data: {get_attr: [ServiceChain, role_data]}}
DeployStepsTasks:
type: OS::Heat::Value
properties:
type: comma_delimited_list
value:
yaql:
# Note we use distinct() here to filter any identical tasks, e.g yum update for all services
expression: coalesce($.data, []).where($ != null).select($.get('deploy_steps_tasks')).where($ != null).flatten().distinct()
data: {get_attr: [ServiceChain, role_data]}
ExternalDeployTasks:
type: OS::Heat::Value
properties:
@ -317,6 +327,7 @@ outputs:
service_config_settings: {get_attr: [ServiceConfigSettings, value]}
workflow_tasks: {get_attr: [WorkflowTasks, value]}
step_config: {get_attr: [PuppetStepConfig, value]}
deploy_steps_tasks: {get_attr: [DeployStepsTasks, value]}
external_deploy_tasks: {get_attr: [ExternalDeployTasks, value]}
external_post_deploy_tasks: {get_attr: [ExternalPostDeployTasks, value]}
upgrade_tasks: {get_attr: [UpgradeTasks, value]}

View File

@ -0,0 +1,5 @@
---
features:
- |
Support added for per-service deploy_steps_tasks which are run every
step on the overcloud nodes.