tripleo-common/workbooks/plan_management.yaml

465 lines
16 KiB
YAML

---
version: '2.0'
name: tripleo.plan_management.v1
description: TripleO Overcloud Deployment Workflows v1
workflows:
create_default_deployment_plan:
description: >
This workflow exists to maintain backwards compatibility in pike. This
workflow will likely be removed in queens in favor of create_deployment_plan.
input:
- container
- queue_name: tripleo
- generate_passwords: true
tasks:
call_create_deployment_plan:
workflow: tripleo.plan_management.v1.create_deployment_plan
on-success: set_status_success
on-error: call_create_deployment_plan_set_status_failed
input:
container: <% $.container %>
queue_name: <% $.queue_name %>
generate_passwords: <% $.generate_passwords %>
use_default_templates: true
set_status_success:
on-success: notify_zaqar
publish:
status: SUCCESS
message: <% task(call_create_deployment_plan).result %>
call_create_deployment_plan_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(call_create_deployment_plan).result %>
notify_zaqar:
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.plan_management.v1.create_default_deployment_plan
payload:
status: <% $.status %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail: <% $.get('status') = "FAILED" %>
create_deployment_plan:
description: >
This workflow provides the capability to create a deployment plan using
the default heat templates provided in a standard TripleO undercloud
deployment, heat templates contained in an external git repository, or a
swift container that already contains templates.
input:
- container
- source_url: null
- queue_name: tripleo
- generate_passwords: true
- use_default_templates: false
tasks:
container_required_check:
description: >
If using the default templates or importing templates from a git
repository, a new container needs to be created. If using an existing
container containing templates, skip straight to create_plan.
on-success:
- verify_container_doesnt_exist: <% $.use_default_templates or $.source_url %>
- create_plan: <% $.use_default_templates = false and $.source_url = null %>
verify_container_doesnt_exist:
action: swift.head_container container=<% $.container %>
on-success: notify_zaqar
on-error: create_container
publish:
status: FAILED
message: "Unable to create plan. The Swift container already exists"
create_container:
action: tripleo.plan.create_container container=<% $.container %>
on-success: templates_source_check
on-error: create_container_set_status_failed
cleanup_temporary_files:
action: tripleo.git.clean container=<% $.container %>
templates_source_check:
on-success:
- upload_default_templates: <% $.use_default_templates = true %>
- clone_git_repo: <% $.source_url != null %>
clone_git_repo:
action: tripleo.git.clone container=<% $.container %> url=<% $.source_url %>
on-success: upload_templates_directory
on-error: clone_git_repo_set_status_failed
upload_templates_directory:
action: tripleo.templates.upload container=<% $.container %> templates_path=<% task(clone_git_repo).result %>
on-success: create_plan
on-complete: cleanup_temporary_files
on-error: upload_templates_directory_set_status_failed
upload_default_templates:
action: tripleo.templates.upload container=<% $.container %>
on-success: create_plan
on-error: upload_to_container_set_status_failed
create_plan:
description: >
Migrate the plan if needed, then continue with the workflow.
TODO(jpichon) - In Queens, the tripleo.plan.migrate action and on_error will
be removed, but the on-success will still be needed.
action: tripleo.plan.migrate plan=<% $.container %>
on-success:
- ensure_passwords_exist: <% $.generate_passwords = true %>
- process_templates: <% $.generate_passwords != true %>
on-error: migrate_plan_set_status_failed
ensure_passwords_exist:
action: tripleo.parameters.generate_passwords container=<% $.container %>
on-success: process_templates
on-error: ensure_passwords_exist_set_status_failed
process_templates:
action: tripleo.templates.process container=<% $.container %>
on-success: set_status_success
on-error: process_templates_set_status_failed
set_status_success:
on-success: notify_zaqar
publish:
status: SUCCESS
message: 'Plan created.'
create_container_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(create_container).result %>
clone_git_repo_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(clone_git_repo).result %>
upload_templates_directory_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(upload_templates_directory).result %>
upload_to_container_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(upload_default_templates).result %>
ensure_passwords_exist_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(ensure_passwords_exist).result %>
process_templates_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(process_templates).result %>
migrate_plan_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(create_plan).result %>
notify_zaqar:
action: zaqar.queue_post
retry: count=5 delay=1
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.plan_management.v1.create_deployment_plan
payload:
status: <% $.status %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail: <% $.get('status') = "FAILED" %>
update_deployment_plan:
input:
- container
- source_url: null
- queue_name: tripleo
- generate_passwords: true
tasks:
templates_source_check:
on-success:
- update_plan: <% $.source_url = null %>
- clone_git_repo: <% $.source_url != null %>
clone_git_repo:
action: tripleo.git.clone container=<% $.container %> url=<% $.source_url %>
on-success: upload_templates_directory
on-error: clone_git_repo_set_status_failed
upload_templates_directory:
action: tripleo.templates.upload container=<% $.container %> templates_path=<% task(clone_git_repo).result %>
on-success: create_swift_rings_backup_plan
on-complete: cleanup_temporary_files
on-error: upload_templates_directory_set_status_failed
cleanup_temporary_files:
action: tripleo.git.clean container=<% $.container %>
create_swift_rings_backup_plan:
workflow: tripleo.swift_rings_backup.v1.create_swift_rings_backup_container_plan
on-success: update_plan
on-error: create_swift_rings_backup_plan_set_status_failed
input:
container: <% $.container %>
queue_name: <% $.queue_name %>
use_default_templates: true
update_plan:
description: >
Migrate the plan if needed, then continue with the workflow.
TODO(jpichon) - In Queens, the tripleo.plan.migrate action and on_error will
be removed, but the on-success will still be needed.
action: tripleo.plan.migrate plan=<% $.container %>
on-success:
- ensure_passwords_exist: <% $.generate_passwords = true %>
- process_templates: <% $.generate_passwords != true %>
on-error: migrate_plan_set_status_failed
ensure_passwords_exist:
action: tripleo.parameters.generate_passwords container=<% $.container %>
on-success: process_templates
on-error: ensure_passwords_exist_set_status_failed
process_templates:
action: tripleo.templates.process container=<% $.container %>
on-success: set_status_success
on-error: process_templates_set_status_failed
set_status_success:
on-success: notify_zaqar
publish:
status: SUCCESS
message: 'Plan updated.'
create_swift_rings_backup_plan_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(create_swift_rings_backup_plan).result %>
clone_git_repo_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(clone_git_repo).result %>
upload_templates_directory_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(upload_templates_directory).result %>
process_templates_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(process_templates).result %>
ensure_passwords_exist_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(ensure_passwords_exist).result %>
migrate_plan_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(update_plan).result %>
notify_zaqar:
action: zaqar.queue_post
retry: count=5 delay=1
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.plan_management.v1.update_deployment_plan
payload:
status: <% $.status %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail: <% $.get('status') = "FAILED" %>
get_passwords:
description: Retrieves passwords for a given plan
input:
- container
- queue_name: tripleo
tasks:
verify_container_exists:
action: swift.head_container container=<% $.container %>
on-success: get_environment_passwords
on-error: verify_container_set_status_failed
get_environment_passwords:
action: tripleo.parameters.get_passwords container=<% $.container %>
on-success: get_passwords_set_status_success
on-error: get_passwords_set_status_failed
get_passwords_set_status_success:
on-success: notify_zaqar
publish:
status: SUCCESS
message: <% task(get_environment_passwords).result %>
get_passwords_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(get_environment_passwords).result %>
verify_container_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(verify_container_exists).result %>
notify_zaqar:
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.plan_management.v1.get_passwords
payload:
status: <% $.status %>
message: <% $.get('message', '') %>
execution: <% execution() %>
on-success:
- fail: <% $.get('status') = "FAILED" %>
export_deployment_plan:
description: Creates an export tarball for a given plan
input:
- plan
- queue_name: tripleo
tasks:
export_plan:
action: tripleo.plan.export
input:
plan: <% $.plan %>
delete_after: 3600
exports_container: "plan-exports"
on-success: create_tempurl
on-error: export_plan_set_status_failed
create_tempurl:
action: tripleo.swift.tempurl
on-success: set_status_success
on-error: create_tempurl_set_status_failed
input:
container: "plan-exports"
obj: "<% $.plan %>.tar.gz"
valid: 3600
set_status_success:
on-success: notify_zaqar
publish:
status: SUCCESS
message: <% task(create_tempurl).result %>
tempurl: <% task(create_tempurl).result %>
export_plan_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(export_plan).result %>
create_tempurl_set_status_failed:
on-success: notify_zaqar
publish:
status: FAILED
message: <% task(create_tempurl).result %>
notify_zaqar:
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.plan_management.v1.export_deployment_plan
payload:
status: <% $.status %>
message: <% $.get('message', '') %>
execution: <% execution() %>
tempurl: <% $.get('tempurl', '') %>
on-success:
- fail: <% $.get('status') = "FAILED" %>
get_deprecated_parameters:
description: Gets the list of deprecated parameters in the whole of the plan including nested stack
input:
- container: overcloud
- queue_name: tripleo
tasks:
get_flatten_data:
action: tripleo.parameters.get_flatten container=<% $.container %>
on-success: get_deprecated_params
on-error: set_status_failed_get_flatten_data
publish:
user_params: <% task().result.environment_parameters %>
parameter_groups: <% task().result.heat_resource_tree.resources.values().where( $.get('parameter_groups') ).select($.parameter_groups).flatten() %>
get_deprecated_params:
on-success: check_if_user_param_has_deprecated
publish:
deprecated_params: <% $.parameter_groups.where($.get('label') = 'deprecated').select($.parameters).flatten().distinct() %>
check_if_user_param_has_deprecated:
on-success: send_message
publish:
formatted: <% let(up => $.user_params) -> $.deprecated_params.select( dict('parameter' => $, 'deprecated' => true, 'user_defined' => $up.keys().contains($)) ) %>
set_status_failed_get_flatten_data:
on-success: send_message
publish:
status: FAILED
message: <% task(get_flatten_data).result %>
send_message:
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.plan_management.v1.get_deprecated_parameters
payload:
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
deprecated: <% $.get('formatted', []) %>
on-success:
- fail: <% $.get('status') = "FAILED" %>