tripleo-common/workbooks/baremetal_deploy.yaml
Dmitry Tantsur 3f83b61611 nova-less-deploy: implement deploy_roles workflow
This workflow allows to deploy a given number of nodes from each role.
It includes generating a suitable environment to use with deployed-server.

Change-Id: I62673f5abda74beab4c1848b96f1ea4746ac3b6d
Implements: blueprint nova-less-deploy
2019-02-28 10:52:41 +00:00

280 lines
8.0 KiB
YAML

---
version: '2.0'
name: tripleo.baremetal_deploy.v1
description: TripleO Baremetal Deployment Workflows
workflows:
_deploy_one:
description: Internal workflow to deploy one node
input:
- instance
- node
- ssh_keys: []
- ssh_user_name: heat-admin
- timeout: 3600
- queue_name: tripleo
tags:
- tripleo-common-managed
tasks:
deploy_node:
action: tripleo.baremetal_deploy.deploy_node
input:
instance: <% $.instance %>
node: <% $.node %>
ssh_keys: <% $.ssh_keys %>
ssh_user_name: <% $.ssh_user_name %>
publish:
instance: <% task().result %>
publish-on-error:
status: FAILED
message: <% task().result %>
on-success: wait_for_deploy
on-error: send_message
wait_for_deploy:
action: tripleo.baremetal_deploy.wait_for_deploy
input:
instance: <% $.instance %>
timeout: <% $.timeout %>
publish:
instance: <% task().result %>
message: Instance <% task().result.hostname %> deployed successfully
publish-on-error:
status: FAILED
message: <% task().result %>
on-complete: send_message
send_message:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
instance: <% $.instance %>
on-success:
- fail: <% $.get('status', 'SUCCESS') != 'SUCCESS' %>
output:
instance: <% $.instance %>
output-on-error:
result: <% $.get('message', 'Deployment failed') %>
deploy_instances:
description: Deploy instances on bare metal nodes.
input:
- instances
- ssh_keys: []
- ssh_user_name: heat-admin
- timeout: 3600
- concurrency: 20
- queue_name: tripleo
tags:
- tripleo-common-managed
tasks:
find_existing_instances:
action: tripleo.baremetal_deploy.check_existing_instances
input:
instances: <% $.instances %>
publish:
instances: <% task().result.not_found %>
existing_instances: <% task().result.instances %>
publish-on-error:
status: FAILED
message: <% task().result %>
on-success: reserve_nodes
on-error: send_message
reserve_nodes:
action: tripleo.baremetal_deploy.reserve_nodes
input:
instances: <% $.instances %>
publish:
reservations: <% task().result.reservations %>
publish-on-error:
status: FAILED
message: <% task().result %>
on-success: deploy_nodes
on-error: send_message
deploy_nodes:
with-items: reservation in <% $.reservations %>
concurrency: <% $.concurrency %>
workflow: _deploy_one
input:
instance: <% $.reservation.instance %>
node: <% $.reservation.node %>
ssh_keys: <% $.ssh_keys %>
ssh_user_name: <% $.ssh_user_name %>
timeout: <% $.timeout %>
queue_name: <% $.queue_name %>
publish:
all_instances: <% task().result.instance + $.existing_instances %>
new_instances: <% task().result.instance %>
publish-on-error:
status: FAILED
message: <% task().result %>
on-success: publish_result
on-error: send_message
publish_result:
publish:
ctlplane_ips: <% $.all_instances.toDict($.hostname, $.ip_addresses.ctlplane[0]) %>
instances: <% $.all_instances.toDict($.hostname, $) %>
port_map: <% $.all_instances.toDict($.hostname, $.port_map) %>
on-complete: send_message
send_message:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
payload:
ctlplane_ips: <% $.get('ctlplane_ips', {}) %>
instances: <% $.get('instances', {}) %>
port_map: <% $.get('port_map', {}) %>
output:
ctlplane_ips: <% $.ctlplane_ips %>
existing_instances: <% $.existing_instances.toDict($.hostname, $) %>
instances: <% $.instances %>
new_instances: <% $.new_instances.toDict($.hostname, $) %>
port_map: <% $.port_map %>
undeploy_instances:
description: Undeploy previously deployed instances
input:
- instances
- timeout: 3600
- concurrency: 20
- queue_name: tripleo
tags:
- tripleo-common-managed
tasks:
undeploy_instances:
with-items: instance in <% $.instances %>
concurrency: <% $.concurrency %>
action: tripleo.baremetal_deploy.undeploy_instance
input:
instance: <% $.instance %>
timeout: <% $.timeout %>
publish-on-error:
status: FAILED
message: <% task().result %>
on-complete: send_message
send_message:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
deploy_roles:
description: Deploy roles on bare metal nodes.
input:
- roles
- plan: overcloud
- ctlplane_network: ctlplane
- ssh_keys: []
- ssh_user_name: heat-admin
- timeout: 3600
- concurrency: 20
- queue_name: tripleo
tags:
- tripleo-common-managed
tasks:
expand_roles:
action: tripleo.baremetal_deploy.expand_roles
input:
roles: <% $.roles %>
stackname: <% $.plan %>
publish:
input_instances: <% task().result.instances %>
environment: <% task().result.environment %>
publish-on-error:
status: FAILED
message: <% task().result %>
on-success: deploy_instances
on-error: send_message
deploy_instances:
workflow: tripleo.baremetal_deploy.v1.deploy_instances
input:
instances: <% $.input_instances %>
ssh_keys: <% $.ssh_keys %>
ssh_user_name: <% $.ssh_user_name %>
timeout: <% $.timeout %>
queue_name: <% $.queue_name %>
publish:
ctlplane_ips: <% task().result.ctlplane_ips %>
instances: <% task().result.instances %>
new_instances: <% task().result.new_instances %>
existing_instances: <% task().result.existing_instances %>
port_map: <% task().result.port_map %>
publish-on-error:
status: FAILED
message: <% task().result %>
on-success: populate_environment
on-error: send_message
populate_environment:
action: tripleo.baremetal_deploy.populate_environment
input:
ctlplane_network: <% $.ctlplane_network %>
environment: <% $.environment %>
port_map: <% $.port_map %>
publish:
environment: <% task().result %>
publish-on-error:
status: FAILED
message: <% task().result %>
on-complete: send_message
send_message:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
payload:
environment: <% $.get('environment', {}) %>
instances: <% $.get('instances', {}) %>
output:
ctlplane_ips: <% $.ctlplane_ips %>
environment: <% $.environment %>
existing_instances: <% $.existing_instances %>
instances: <% $.instances %>
new_instances: <% $.new_instances %>
port_map: <% $.port_map %>