Manages virtual machines supported by libvirt.
- python >= 2.6
- libvirt-python
parameter | required | default | choices | comments |
---|---|---|---|---|
command |
no |
|
in addition to state management, various non-idempotent commands are available. See examples | |
name |
yes | name of the guest VM being managed. Note that VM must be previously defined with xml. | ||
state |
no | no |
|
Note that there may be some lag for state requests like shutdown since these refer only to VM states. After starting a guest, it may not be immediately accessible. |
uri |
no | libvirt connection uri | ||
xml |
no | XML document used with the define command |
# a playbook task line: - virt: name=alpha state=running # /usr/bin/ansible invocations ansible host -m virt -a "name=alpha command=status" ansible host -m virt -a "name=alpha command=get_xml" ansible host -m virt -a "name=alpha command=create uri=lxc:///" # a playbook example of defining and launching an LXC guest tasks: - name: define vm virt: name=foo command=define xml="{{ lookup('template', 'container-template.xml.j2') }}" uri=lxc:/// - name: start vm virt: name=foo state=running uri=lxc:///
For more information on what this means please read Extras Modules
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.