tripleo-common/workbooks/validations.yaml

208 lines
6.0 KiB
YAML

---
version: '2.0'
name: tripleo.validations.v1
description: TripleO Validations Workflows v1
workflows:
run_validation:
input:
- validation_name
- plan: overcloud
- queue_name: tripleo
tasks:
notify_running:
on-complete: run_validation
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.validations.v1.run_validation
payload:
validation_name: <% $.validation_name %>
plan: <% $.plan %>
status: RUNNING
execution: <% execution() %>
run_validation:
on-success: send_message
on-error: set_status_failed
action: tripleo.validations.run_validation validation=<% $.validation_name %> plan=<% $.plan %>
publish:
status: SUCCESS
stdout: <% task(run_validation).result.stdout %>
stderr: <% task(run_validation).result.stderr %>
set_status_failed:
on-complete: send_message
publish:
status: FAILED
stdout: <% task(run_validation).result.stdout %>
stderr: <% task(run_validation).result.stderr %>
send_message:
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.validations.v1.run_validation
payload:
validation_name: <% $.validation_name %>
plan: <% $.plan %>
status: <% $.get('status', 'SUCCESS') %>
stdout: <% $.stdout %>
stderr: <% $.stderr %>
execution: <% execution() %>
run_validations:
input:
- validation_names: []
- plan: overcloud
- queue_name: tripleo
tasks:
notify_running:
on-complete: run_validations
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.validations.v1.run_validations
payload:
validation_names: <% $.validation_names %>
plan: <% $.plan %>
status: RUNNING
execution: <% execution() %>
run_validations:
on-success: send_message
on-error: set_status_failed
workflow: tripleo.validations.v1.run_validation validation_name=<% $.validation %> plan=<% $.plan %> queue_name=<% $.queue_name %>
with-items: validation in <% $.validation_names %>
publish:
status: SUCCESS
set_status_failed:
on-complete: send_message
publish:
status: FAILED
send_message:
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.validations.v1.run_validations
payload:
validation_names: <% $.validation_names %>
plan: <% $.plan %>
status: <% $.get('status', 'SUCCESS') %>
execution: <% execution() %>
run_groups:
input:
- group_names: []
- plan: overcloud
- queue_name: tripleo
tasks:
find_validations:
on-success: notify_running
action: tripleo.validations.list_validations groups=<% $.group_names %>
publish:
validations: <% task(find_validations).result %>
notify_running:
on-complete: run_validation_group
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.validations.v1.run_validations
payload:
group_names: <% $.group_names %>
validation_names: <% $.validations.id %>
plan: <% $.plan %>
status: RUNNING
execution: <% execution() %>
run_validation_group:
on-success: send_message
on-error: set_status_failed
workflow: tripleo.validations.v1.run_validation validation_name=<% $.validation %> plan=<% $.plan %> queue_name=<% $.queue_name %>
with-items: validation in <% $.validations.id %>
publish:
status: SUCCESS
set_status_failed:
on-complete: send_message
publish:
status: FAILED
send_message:
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.validations.v1.run_groups
payload:
group_names: <% $.group_names %>
validation_names: <% $.validations.id %>
plan: <% $.plan %>
status: <% $.get('status', 'SUCCESS') %>
execution: <% execution() %>
list:
input:
- group_names: []
tasks:
find_validations:
action: tripleo.validations.list_validations groups=<% $.group_names %>
list_groups:
tasks:
find_groups:
action: tripleo.validations.list_groups
copy_ssh_key:
input:
- overcloud_admin: heat-admin
- queue_name: tripleo
tasks:
get_servers:
action: nova.servers_list
on-success: get_pubkey
publish:
servers: <% task(get_servers).result._info %>
get_pubkey:
action: tripleo.validations.get_pubkey
on-success: deploy_ssh_key
publish:
pubkey: <% task(get_pubkey).result %>
deploy_ssh_key:
workflow: tripleo.deployment.v1.deploy_on_server
with-items: server in <% $.servers %>
input:
server_name: <% $.server.name %>
server_uuid: <% $.server.id %>
config: |
#!/bin/bash
if ! grep "<% $.pubkey %>" /home/<% $.overcloud_admin %>/.ssh/authorized_keys; then
echo "<% $.pubkey %>" >> /home/<% $.overcloud_admin %>/.ssh/authorized_keys
fi
config_name: copy_ssh_key
group: script
queue_name: <% $.queue_name %>