Advertisement
Guest User

Untitled

a guest
Mar 14th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. ---
  2. version: '2.0'
  3.  
  4. perform_tasks_on_vms:
  5. input:
  6. - username
  7. - password
  8. - vm_ids: null
  9. - cmd: null
  10.  
  11. tasks:
  12. schedule_upgrade:
  13. on-success:
  14. - get_hosts: <% $.vm_ids != null %>
  15. - get_vms: <% $.vm_ids = null %>
  16.  
  17. get_vms:
  18. action: nova.servers_list
  19. publish:
  20. vm_ids: <% task(get_vms).result.id %>
  21. keep-result: false
  22. on-success:
  23. - get_hosts
  24.  
  25. get_hosts:
  26. with-items: id in <% $.vm_ids %>
  27. action: nova.servers_get server=<% $.id %>
  28. publish:
  29. hosts: <% task(get_hosts).result.select({ip => $.addresses.get($.addresses.keys().first()).where($.get("OS-EXT-IPS:type") = fixed).first().addr}).ip %>
  30. keep-result: false
  31. on-success:
  32. - action_on_vm
  33.  
  34. action_on_vm:
  35. with-items: host in <% $.hosts %>
  36. action: std.ssh host=<% $.host %> username=<% $.username %> password=<% $.password %>
  37. input:
  38. cmd: "cd / && ls"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement