Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- version: '2.0'
- perform_tasks_on_vms:
- input:
- - username
- - password
- - vm_ids: null
- - cmd: null
- tasks:
- schedule_upgrade:
- on-success:
- - get_hosts: <% $.vm_ids != null %>
- - get_vms: <% $.vm_ids = null %>
- get_vms:
- action: nova.servers_list
- publish:
- vm_ids: <% task(get_vms).result.id %>
- keep-result: false
- on-success:
- - get_hosts
- get_hosts:
- with-items: id in <% $.vm_ids %>
- action: nova.servers_get server=<% $.id %>
- publish:
- hosts: <% task(get_hosts).result.select({ip => $.addresses.get($.addresses.keys().first()).where($.get("OS-EXT-IPS:type") = fixed).first().addr}).ip %>
- keep-result: false
- on-success:
- - action_on_vm
- action_on_vm:
- with-items: host in <% $.hosts %>
- action: std.ssh host=<% $.host %> username=<% $.username %> password=<% $.password %>
- input:
- cmd: "cd / && ls"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement