519 lines
16 KiB
YAML
519 lines
16 KiB
YAML
---
|
|
version: '2.0'
|
|
name: tripleo.deployment.v1
|
|
description: TripleO deployment workflows
|
|
|
|
workflows:
|
|
|
|
deploy_on_server:
|
|
|
|
input:
|
|
- server_uuid
|
|
- server_name
|
|
- config
|
|
- config_name
|
|
- group
|
|
- queue_name: tripleo
|
|
|
|
tags:
|
|
- tripleo-common-managed
|
|
|
|
tasks:
|
|
|
|
deploy_config:
|
|
action: tripleo.deployment.config
|
|
on-complete: send_message
|
|
input:
|
|
server_id: <% $.server_uuid %>
|
|
name: <% $.config_name %>
|
|
config: <% $.config %>
|
|
group: <% $.group %>
|
|
publish:
|
|
stdout: <% task().result.deploy_stdout %>
|
|
stderr: <% task().result.deploy_stderr %>
|
|
status_code: <% task().result.deploy_status_code %>
|
|
publish-on-error:
|
|
status: FAILED
|
|
message: <% task().result %>
|
|
|
|
send_message:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
execution: <% execution() %>
|
|
status: <% $.get("status", "SUCCESS") %>
|
|
message: <% $.get("message", "") %>
|
|
payload:
|
|
server_uuid: <% $.server_uuid %>
|
|
server_name: <% $.server_name %>
|
|
config_name: <% $.config_name %>
|
|
status_code: <% $.get("status_code", "") %>
|
|
stdout: <% $.get("stdout", "") %>
|
|
stderr: <% $.get("stderr", "") %>
|
|
|
|
deploy_on_servers:
|
|
|
|
input:
|
|
- server_name
|
|
- config_name
|
|
- config
|
|
- group: script
|
|
- queue_name: tripleo
|
|
|
|
tags:
|
|
- tripleo-common-managed
|
|
|
|
tasks:
|
|
|
|
check_if_all_servers:
|
|
on-success:
|
|
- get_servers_matching: <% $.server_name != "all" %>
|
|
- get_all_servers: <% $.server_name = "all" %>
|
|
|
|
get_servers_matching:
|
|
action: nova.servers_list
|
|
on-success: deploy_on_servers
|
|
publish:
|
|
servers_with_name: <% task().result._info.where($.name.indexOf(execution().input.server_name) > -1) %>
|
|
|
|
get_all_servers:
|
|
action: nova.servers_list
|
|
on-success: deploy_on_servers
|
|
publish:
|
|
servers_with_name: <% task().result._info %>
|
|
|
|
deploy_on_servers:
|
|
on-success: send_success_message
|
|
on-error: send_failed_message
|
|
with-items: server in <% $.servers_with_name %>
|
|
workflow: tripleo.deployment.v1.deploy_on_server
|
|
input:
|
|
server_name: <% $.server.name %>
|
|
server_uuid: <% $.server.id %>
|
|
config: <% $.config %>
|
|
config_name: <% $.config_name %>
|
|
group: <% $.group %>
|
|
queue_name: <% $.queue_name %>
|
|
|
|
send_success_message:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
status: SUCCESS
|
|
execution: <% execution() %>
|
|
|
|
send_failed_message:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
status: FAILED
|
|
execution: <% execution() %>
|
|
message: <% task(deploy_on_servers).result %>
|
|
|
|
deploy_plan:
|
|
|
|
description: >
|
|
Deploy the overcloud for a plan.
|
|
|
|
input:
|
|
- container
|
|
- run_validations: False
|
|
- timeout: 240
|
|
- skip_deploy_identifier: False
|
|
- queue_name: tripleo
|
|
- config_download: False
|
|
|
|
tags:
|
|
- tripleo-common-managed
|
|
|
|
tasks:
|
|
send_start_message:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
status: RUNNING
|
|
deployment_status: DEPLOYING
|
|
message: "Initializing <% $.container %> plan deployment"
|
|
execution: <% execution() %>
|
|
plan_name: <% $.container %>
|
|
on-complete: add_validation_ssh_key
|
|
|
|
add_validation_ssh_key:
|
|
workflow: tripleo.validations.v1.add_validation_ssh_key_parameter
|
|
input:
|
|
container: <% $.container %>
|
|
queue_name: <% $.queue_name %>
|
|
on-complete:
|
|
- run_validations: <% $.run_validations %>
|
|
- create_swift_rings_backup_plan: <% not $.run_validations %>
|
|
|
|
run_validations:
|
|
workflow: tripleo.validations.v1.run_groups
|
|
input:
|
|
group_names:
|
|
- 'pre-deployment'
|
|
plan: <% $.container %>
|
|
queue_name: <% $.queue_name %>
|
|
publish-on-error:
|
|
message: <% task().result %>
|
|
on-success: create_swift_rings_backup_plan
|
|
on-error: set_deployment_failed
|
|
|
|
create_swift_rings_backup_plan:
|
|
workflow: tripleo.swift_rings_backup.v1.create_swift_rings_backup_container_plan
|
|
input:
|
|
container: <% $.container %>
|
|
queue_name: <% $.queue_name %>
|
|
use_default_templates: true
|
|
publish-on-error:
|
|
message: <% task().result %>
|
|
on-success: cell_v2_discover_hosts
|
|
on-error: set_deployment_failed
|
|
|
|
cell_v2_discover_hosts:
|
|
action: tripleo.baremetal.cell_v2_discover_hosts
|
|
publish-on-error:
|
|
message: <% task().result %>
|
|
on-success: send_stack_deployment_message
|
|
on-error: set_deployment_failed
|
|
|
|
send_stack_deployment_message:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
status: RUNNING
|
|
deployment_status: DEPLOYING
|
|
message: "Creating <% $.container %> Heat stack"
|
|
execution: <% execution() %>
|
|
plan_name: <% $.container %>
|
|
on-complete: deploy
|
|
|
|
deploy:
|
|
action: tripleo.deployment.deploy
|
|
input:
|
|
timeout: <% $.timeout %>
|
|
container: <% $.container %>
|
|
skip_deploy_identifier: <% $.skip_deploy_identifier %>
|
|
publish-on-error:
|
|
message: <% task().result %>
|
|
on-success:
|
|
- wait_for_stack_complete: <% $.config_download %>
|
|
- set_deployment_success: <% not $.config_download %>
|
|
on-error: set_deployment_failed
|
|
|
|
wait_for_stack_complete:
|
|
workflow: tripleo.stack.v1.wait_for_stack_complete_or_failed
|
|
input:
|
|
stack: <% $.container %>
|
|
queue_name: <% $.queue_name %>
|
|
publish-on-error:
|
|
message: <% task().result %>
|
|
publish:
|
|
message: Stack status <% task().result.stack_status %>
|
|
on-error: set_deployment_failed
|
|
on-success:
|
|
- message_stack_complete: <% task().result.stack_status = "CREATE_COMPLETE" %>
|
|
- get_servers: <% task().result.stack_status = "CREATE_COMPLETE" %>
|
|
- set_deployment_failed: <% task().result.stack_status != "CREATE_COMPLETE" %>
|
|
|
|
message_stack_complete:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
status: <% $.get('status', 'RUNNING') %>
|
|
deployment_status: DEPLOYING
|
|
execution: <% execution() %>
|
|
plan_name: <% $.container %>
|
|
message: <% $.get("message", "") %>
|
|
|
|
get_servers:
|
|
action: nova.servers_list
|
|
publish:
|
|
# FIXME(mandre) we want only the servers part of the plan
|
|
servers: <% task().result._info.select($.addresses.ctlplane.addr).flatten() %>
|
|
publish-on-error:
|
|
message: <% task().result %>
|
|
on-success: get_private_key
|
|
on-error: set_deployment_failed
|
|
|
|
get_private_key:
|
|
action: tripleo.validations.get_privkey
|
|
publish:
|
|
private_key: <% task().result %>
|
|
publish-on-error:
|
|
message: <% task().result %>
|
|
on-success: enable_ssh_admin
|
|
on-error: set_deployment_failed
|
|
|
|
enable_ssh_admin:
|
|
workflow: tripleo.access.v1.enable_ssh_admin
|
|
input:
|
|
ssh_servers: <% $.servers %>
|
|
ssh_private_key: <% $.private_key %>
|
|
# FIXME(mandre) this shouldn't be hardcoded
|
|
ssh_user: heat-admin
|
|
publish-on-error:
|
|
message: <% task().result %>
|
|
on-success: config_download_deploy
|
|
on-error: set_deployment_failed
|
|
|
|
config_download_deploy:
|
|
workflow: config_download_deploy
|
|
input:
|
|
plan_name: <% $.container %>
|
|
queue_name: <% $.queue_name %>
|
|
publish-on-error:
|
|
message: <% task().result %>
|
|
on-success: set_deployment_success
|
|
on-error: set_deployment_failed
|
|
|
|
set_deployment_failed:
|
|
on-success: send_message
|
|
publish:
|
|
status: FAILED
|
|
deployment_status: DEPLOY_FAILED
|
|
|
|
set_deployment_success:
|
|
on-success: send_message
|
|
publish:
|
|
status: SUCCESS
|
|
deployment_status: DEPLOY_SUCCESS
|
|
|
|
send_message:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
status: <% $.status %>
|
|
message: <% $.get('message', '') %>
|
|
execution: <% execution() %>
|
|
plan_name: <% $.container %>
|
|
deployment_status: <% $.deployment_status %>
|
|
|
|
get_horizon_url:
|
|
|
|
description: >
|
|
Retrieve the Horizon URL from the Overcloud stack.
|
|
|
|
input:
|
|
- stack: overcloud
|
|
- queue_name: tripleo
|
|
|
|
tags:
|
|
- tripleo-common-managed
|
|
|
|
output:
|
|
horizon_url: <% $.horizon_url %>
|
|
|
|
tasks:
|
|
get_horizon_url:
|
|
action: heat.stacks_get
|
|
input:
|
|
stack_id: <% $.stack %>
|
|
publish:
|
|
horizon_url: <% task().result.outputs.where($.output_key = "EndpointMap").output_value.HorizonPublic.uri.single() %>
|
|
on-success: send_message
|
|
publish-on-error:
|
|
status: FAILED
|
|
message: <% task().result %>
|
|
|
|
send_message:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
status: <% $.get('status', 'SUCCESS') %>
|
|
execution: <% execution() %>
|
|
message: <% $.get('message', '') %>
|
|
payload:
|
|
horizon_url: <% $.get('horizon_url', '') %>
|
|
|
|
config_download_deploy:
|
|
|
|
description: >
|
|
Configure the overcloud with config-download.
|
|
|
|
input:
|
|
- timeout: 240
|
|
- queue_name: tripleo
|
|
- plan_name: overcloud
|
|
- work_dir: /var/lib/mistral
|
|
- verbosity: 1
|
|
|
|
tags:
|
|
- tripleo-common-managed
|
|
|
|
tasks:
|
|
|
|
get_config:
|
|
action: tripleo.config.get_overcloud_config
|
|
input:
|
|
container: <% $.get('plan_name') %>
|
|
on-success: download_config
|
|
on-error: send_message
|
|
publish-on-error:
|
|
status: FAILED
|
|
message: <% task().result %>
|
|
|
|
download_config:
|
|
action: tripleo.config.download_config
|
|
input:
|
|
work_dir: <% $.get('work_dir') %>/<% execution().id %>
|
|
on-success: send_msg_config_download
|
|
on-error: send_message
|
|
publish-on-error:
|
|
status: FAILED
|
|
message: <% task().result %>
|
|
|
|
send_msg_config_download:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
status: <% $.get('status', 'RUNNING') %>
|
|
deployment_status: DEPLOYING
|
|
execution: <% execution() %>
|
|
message: Config downloaded at <% $.get('work_dir') %>/<% execution().id %>
|
|
plan_name: <% $.plan_name %>
|
|
on-success: get_private_key
|
|
|
|
get_private_key:
|
|
action: tripleo.validations.get_privkey
|
|
publish:
|
|
private_key: <% task().result %>
|
|
on-success: generate_inventory
|
|
on-error: send_message
|
|
publish-on-error:
|
|
status: FAILED
|
|
message: <% task().result %>
|
|
|
|
generate_inventory:
|
|
action: tripleo.ansible-generate-inventory
|
|
input:
|
|
ansible_ssh_user: tripleo-admin
|
|
work_dir: <% $.get('work_dir') %>/<% execution().id %>
|
|
plan_name: <% $.get('plan_name') %>
|
|
publish:
|
|
inventory: <% task().result %>
|
|
on-success: send_msg_generate_inventory
|
|
on-error: send_message
|
|
publish-on-error:
|
|
status: FAILED
|
|
message: <% task().result %>
|
|
|
|
send_msg_generate_inventory:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
status: <% $.get('status', 'RUNNING') %>
|
|
deployment_status: DEPLOYING
|
|
execution: <% execution() %>
|
|
message: Inventory generated at <% $.get('inventory') %>
|
|
plan_name: <% $.plan_name %>
|
|
on-success: send_msg_run_ansible
|
|
|
|
send_msg_run_ansible:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
status: <% $.get('status', 'RUNNING') %>
|
|
deployment_status: DEPLOYING
|
|
execution: <% execution() %>
|
|
plan_name: <% $.plan_name %>
|
|
message: >
|
|
Running ansible playbook at <% $.get('work_dir') %>/<% execution().id %>/deploy_steps_playbook.yaml.
|
|
See log file at <% $.get('work_dir') %>/<% execution().id %>/ansible.log for progress.
|
|
...
|
|
on-success: run_ansible
|
|
|
|
run_ansible:
|
|
action: tripleo.ansible-playbook
|
|
input:
|
|
inventory: <% $.inventory %>
|
|
playbook: <% $.get('work_dir') %>/<% execution().id %>/deploy_steps_playbook.yaml
|
|
playbook_name: deploy_steps_playbook.yaml
|
|
plan_name: <% $.plan_name %>
|
|
remote_user: tripleo-admin
|
|
ssh_private_key: <% $.private_key %>
|
|
use_openstack_credentials: true
|
|
verbosity: <% $.get('verbosity') %>
|
|
become: true
|
|
timeout: <% $.timeout %>
|
|
work_dir: <% $.get('work_dir') %>/<% execution().id %>
|
|
queue_name: <% $.queue_name %>
|
|
reproduce_command: true
|
|
trash_output: true
|
|
publish:
|
|
log_path: <% task().result.get('log_path') %>
|
|
on-success:
|
|
- ansible_passed: <% task().result.returncode = 0 %>
|
|
- ansible_failed: <% task().result.returncode != 0 %>
|
|
on-error: send_message
|
|
publish-on-error:
|
|
status: FAILED
|
|
message: Ansible failed, check log at <% $.get('work_dir') %>/<% execution().id %>/ansible.log.
|
|
|
|
ansible_passed:
|
|
on-success: send_message
|
|
publish:
|
|
status: SUCCESS
|
|
message: Ansible passed.
|
|
|
|
ansible_failed:
|
|
on-success: send_message
|
|
publish:
|
|
status: FAILED
|
|
message: Ansible failed, check log at <% $.get('work_dir') %>/<% execution().id %>/ansible.log.
|
|
|
|
send_message:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
status: <% $.get('status', 'SUCCESS') %>
|
|
execution: <% execution() %>
|
|
message: <% $.get('message', '') %>
|
|
plan_name: <% $.plan_name %>
|
|
|
|
create_overcloudrc:
|
|
description: >
|
|
Given the name of a container, generate the overcloudrc files
|
|
needed to access the overcloud via the CLI.
|
|
|
|
tags:
|
|
- tripleo-common-managed
|
|
|
|
input:
|
|
- container: overcloud
|
|
- queue_name: tripleo
|
|
|
|
tasks:
|
|
generate_overcloud_rc:
|
|
action: tripleo.deployment.overcloudrc
|
|
input:
|
|
container: <% $.container %>
|
|
on-complete: send_message
|
|
publish-on-error:
|
|
status: FAILED
|
|
message: <% task().result %>
|
|
publish:
|
|
status: SUCCESS
|
|
message: <% task().result %>
|
|
|
|
send_message:
|
|
workflow: tripleo.messaging.v1.send
|
|
input:
|
|
queue_name: <% $.queue_name %>
|
|
type: <% execution().name %>
|
|
status: <% $.status %>
|
|
execution: <% execution() %>
|
|
message: <% $.get('message', '') %>
|