Advertisement
Guest User

Untitled

a guest
Mar 18th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. version: '2.0'
  2.  
  3. create_vm:
  4. description: Simple workflow example
  5. type: direct
  6. input:
  7. - vm_name
  8. - image_ref
  9. - flavor_ref
  10. - private_net_id
  11. - username
  12. - password
  13. output:
  14. vm_id: <% $.vm_id %>
  15.  
  16. tasks:
  17.  
  18. create_server:
  19. action: nova.servers_create
  20. input:
  21. name: <% $.vm_name %>
  22. image: <% $.image_ref %>
  23. flavor: <% $.flavor_ref %>
  24. nics: [ "net-id": <% $.private_net_id %> ]
  25. publish:
  26. vm_id: <% $.create_server.id %>
  27. on-success:
  28. - wait_for_instance
  29.  
  30. wait_for_instance:
  31. action: nova.servers_find id=<% $.vm_id %> status='ACTIVE'
  32. #action: nova.servers_interface_list server=<% $.vm_id %>
  33. retry:
  34. delay: 5
  35. count: 15
  36. on-success:
  37. - get_interface_list
  38.  
  39. get_interface_list:
  40. action : nova.servers_interface_list server=<% $.vm_id %>
  41. publish:
  42. interface_list: <% $.get_interface_list %>
  43. on-success : ssh_to_machine
  44.  
  45. ssh_to_machine:
  46. with-items: vm in <% $.interface_list %>
  47. action: std.ssh
  48. input:
  49. cmd: "echo 1 > /tmp/testing"
  50. host: <% $.vm.fixed_ips.ip_address %>
  51. username: <% $.username %>
  52. password: <% $.password %>
  53. publish:
  54. res: <% $.ssh_to_machine %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement