f2a1a63ced
* From standard workflows * From functional test resources Change-Id: I25e0d048222b6b7b1f3ffb3a9cf5029b7e6bcf45
74 lines
1.7 KiB
YAML
74 lines
1.7 KiB
YAML
---
|
|
version: '2.0'
|
|
|
|
std.create_instance:
|
|
type: direct
|
|
|
|
description: |
|
|
Creates VM and waits till VM OS is up and running.
|
|
|
|
input:
|
|
- name
|
|
- image_id
|
|
- flavor_id
|
|
- ssh_username
|
|
- ssh_password
|
|
|
|
task-defaults:
|
|
on-error:
|
|
- delete_vm
|
|
|
|
output:
|
|
ip: <% $.vm_ip %>
|
|
id: <% $.vm_id %>
|
|
name: <% $.name %>
|
|
status: <% $.status %>
|
|
|
|
tasks:
|
|
create_vm:
|
|
description: Initial request to create a VM.
|
|
action: nova.servers_create name=<% $.name %> image=<% $.image_id %> flavor=<% $.flavor_id %>
|
|
publish:
|
|
vm_id: <% $.create_vm.id %>
|
|
on-success:
|
|
- search_for_ip
|
|
|
|
search_for_ip:
|
|
description: Gets first free ip from Nova floating IPs.
|
|
action: nova.floating_ips_findall instance_id=null
|
|
publish:
|
|
vm_ip: <% $.search_for_ip[0].ip %>
|
|
on-success:
|
|
- wait_vm_active
|
|
|
|
wait_vm_active:
|
|
description: Waits till VM is ACTIVE.
|
|
action: nova.servers_find id=<% $.vm_id %> status="ACTIVE"
|
|
retry:
|
|
count: 10
|
|
delay: 10
|
|
publish:
|
|
status: <% $.wait_vm_active.status %>
|
|
on-success:
|
|
- associate_ip
|
|
|
|
associate_ip:
|
|
description: Associate server with one of floating IPs.
|
|
action: nova.servers_add_floating_ip server=<% $.vm_id %> address=<% $.vm_ip %>
|
|
wait-after: 5
|
|
on-success:
|
|
- wait_ssh
|
|
|
|
wait_ssh:
|
|
description: Wait till operating system on the VM is up (SSH command).
|
|
action: std.wait_ssh username=<% $.ssh_username %> password=<% $.ssh_password %> host=<% $.vm_ip %>
|
|
retry:
|
|
count: 10
|
|
delay: 10
|
|
|
|
delete_vm:
|
|
description: Destroy VM.
|
|
workflow: std.delete_instance instance_id=<% $.vm_id %>
|
|
on-complete:
|
|
- fail
|