623 lines
21 KiB
YAML
623 lines
21 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 %>
|
|
plan_params: <% task().result.heat_resource_tree.parameters.keys() %>
|
|
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: get_unused_params
|
|
publish:
|
|
deprecated_result: <% let(up => $.user_params) -> $.deprecated_params.select( dict('parameter' => $, 'deprecated' => true, 'user_defined' => $up.keys().contains($)) ) %>
|
|
|
|
# Get the list of parameters, which are defined by user via environment files's parameter_default, but not part of the plan definition
|
|
# It may be possible that the parameter will be used by a service, but the service is not part of the plan.
|
|
# In such cases, the parameter will be reported as unused, care should be take to understand whether it is really unused or not.
|
|
get_unused_params:
|
|
on-success: send_message
|
|
publish:
|
|
unused_params: <% let(plan_params => $.plan_params) -> $.user_params.keys().where( not $plan_params.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('deprecated_result', []) %>
|
|
unused: <% $.get('unused_params', []) %>
|
|
on-success:
|
|
- fail: <% $.get('status') = "FAILED" %>
|
|
|
|
publish_ui_logs_to_swift:
|
|
description: >
|
|
This workflow drains a zaqar queue, and publish its messages into a log
|
|
file in swift. This workflow is called by cron trigger.
|
|
|
|
input:
|
|
- queue_name: tripleo
|
|
- logging_queue_name: tripleo-ui-logging
|
|
- logging_container: tripleo-ui-logs
|
|
|
|
tasks:
|
|
|
|
get_messages:
|
|
action: zaqar.queue_messages
|
|
on-success: format_messages
|
|
on-error: get_messages_set_status_failed
|
|
input:
|
|
queue_name: <% $.logging_queue_name %>
|
|
|
|
publish:
|
|
messages: <% task(get_messages).result %>
|
|
|
|
format_messages:
|
|
action: tripleo.logging_to_swift.format_messages
|
|
on-success: upload_to_swift
|
|
input:
|
|
messages: <% $.messages %>
|
|
|
|
publish:
|
|
messages: <% task(format_messages).result %>
|
|
|
|
upload_to_swift:
|
|
action: tripleo.logging_to_swift.publish_ui_log_to_swift
|
|
on-success: set_status_success
|
|
on-error: upload_to_swift_set_status_failed
|
|
input:
|
|
logging_data: <% $.messages %>
|
|
logging_container: <% $.logging_container %>
|
|
|
|
set_status_success:
|
|
on-success: notify_zaqar
|
|
publish:
|
|
status: SUCCESS
|
|
message: <% task(upload_to_swift).result %>
|
|
|
|
upload_to_swift_set_status_failed:
|
|
on-success: notify_zaqar
|
|
publish:
|
|
status: FAILED
|
|
message: <% task(upload_to_swift).result %>
|
|
|
|
get_messages_set_status_failed:
|
|
on-success: notify_zaqar
|
|
publish:
|
|
status: FAILED
|
|
message: <% task(get_messages).result %>
|
|
|
|
notify_zaqar:
|
|
action: zaqar.queue_post
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
messages:
|
|
body:
|
|
type: tripleo.plan_management.v1.publish_ui_logs_to_swift
|
|
payload:
|
|
status: <% $.status %>
|
|
message: <% $.get('message', '') %>
|
|
execution: <% execution() %>
|
|
on-success:
|
|
- fail: <% $.get('status') = "FAILED" %>
|
|
|
|
download_logs:
|
|
description: Creates a tarball with logging data
|
|
input:
|
|
- queue_name: tripleo
|
|
- logging_container: "tripleo-ui-logs"
|
|
- downloads_container: "tripleo-ui-logs-downloads"
|
|
- delete_after: 3600
|
|
|
|
tasks:
|
|
|
|
publish_logs:
|
|
workflow: tripleo.plan_management.v1.publish_ui_logs_to_swift
|
|
on-success: prepare_log_download
|
|
on-error: publish_logs_set_status_failed
|
|
|
|
prepare_log_download:
|
|
action: tripleo.logging_to_swift.prepare_log_download
|
|
input:
|
|
logging_container: <% $.logging_container %>
|
|
downloads_container: <% $.downloads_container %>
|
|
delete_after: <% $.delete_after %>
|
|
on-success: create_tempurl
|
|
on-error: download_logs_set_status_failed
|
|
publish:
|
|
filename: <% task(prepare_log_download).result %>
|
|
|
|
create_tempurl:
|
|
action: tripleo.swift.tempurl
|
|
on-success: set_status_success
|
|
on-error: create_tempurl_set_status_failed
|
|
input:
|
|
container: <% $.downloads_container %>
|
|
obj: <% $.filename %>
|
|
valid: 3600
|
|
publish:
|
|
tempurl: <% task(create_tempurl).result %>
|
|
|
|
set_status_success:
|
|
on-success: notify_zaqar
|
|
publish:
|
|
status: SUCCESS
|
|
message: <% task(create_tempurl).result %>
|
|
tempurl: <% task(create_tempurl).result %>
|
|
|
|
publish_logs_set_status_failed:
|
|
on-success: notify_zaqar
|
|
publish:
|
|
status: FAILED
|
|
message: <% task(publish_logs).result %>
|
|
|
|
download_logs_set_status_failed:
|
|
on-success: notify_zaqar
|
|
publish:
|
|
status: FAILED
|
|
message: <% task(prepare_log_download).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.download_logs
|
|
payload:
|
|
status: <% $.status %>
|
|
message: <% $.get('message', '') %>
|
|
execution: <% execution() %>
|
|
tempurl: <% $.get('tempurl', '') %>
|
|
on-success:
|
|
- fail: <% $.get('status') = "FAILED" %>
|