ansible/ansible — pull request #2702 by DazWorrall (2013-04-17 16:00:24+00:00)
Title: Add define command to virt module

This allows you to define a VM if one with the given name doesn't already exist, it can be used in a playbook like so:

````yaml
- name: define vm
virt: name=myvm command=define xml="{{item}}" uri=lxc:///
with_template: ["container-template.xml.j2"]
- name: start vm
virt: name=myvm state=running uri=lxc:///
````
I'm not particularly happy with how the xml argument is populated, but it does work - suggestions for a better syntax welcome, I'm still getting my head around some of this.

One obvious caveat is that it wont re-define a VM for you if the XML changes, but I dont think you could safely do that anyway.