tripleo-common/workbooks/baremetal_deploy.yaml
Dmitry Tantsur 1ca666b2df nova-less-deploy: deploy_instances and undeploy_instances workflows
This change adds a workflow to provision bare metal machines using
Ironic API without Nova (through the metalsmith library for convenience).
A simple workflow to unprovision nodes is included as well.

This is the first step towards supporting deployment without Nova.

Change-Id: I7c7aeb83691865d37ebed4d6cad7524339fdb799
Implements: blueprint nova-less-deploy
2019-01-16 12:41:42 +01:00

191 lines
5.3 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, $) %>
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', {}) %>
output:
ctlplane_ips: <% $.ctlplane_ips %>
existing_instances: <% $.existing_instances.toDict($.hostname, $) %>
instances: <% $.instances %>
new_instances: <% $.new_instances.toDict($.hostname, $) %>
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() %>