Skip to content

Instantly share code, notes, and snippets.

@jpic
Created October 23, 2014 00:29
Show Gist options
  • Save jpic/d7769dbbeb2262f2a29b to your computer and use it in GitHub Desktop.
Save jpic/d7769dbbeb2262f2a29b to your computer and use it in GitHub Desktop.
[foo]
hosta ansible_ssh_host=localhost kvm=kvma ansible_python_interpreter=/usr/bin/python2
hostb ansible_ssh_host=localhost kvm=kvmb ansible_python_interpreter=/usr/bin/python2
[kvm]
kvma ansible_ssh_host=localhost ansible_python_interpreter=/usr/bin/python2
kvmb ansible_ssh_host=localhost ansible_python_interpreter=/usr/bin/python2
---
- hosts: foo
serial: 1
vars:
snapshot_name: "MEP-{{ ansible_date_time['date'] }}-{{ ansible_date_time['time'] }}"
kvm: "{{ hostvars[inventory_hostname]['kvm'] }}"
tasks:
- name: do something on the kvm hosting the vm
shell: echo domain={{ inventory_hostname }} kvm={{ kvm }} snapshot_name={{ snapshot_name }}
delegate_to: "{{ kvm }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment