Add virt guest creation to virt module docs

This commit is contained in:
Michael DeHaan 2013-04-27 11:20:35 -04:00
parent c3cf446a8a
commit 8f4b7c43a5

26
virt
View file

@ -55,18 +55,28 @@ options:
- XML document used with the define command
required: false
default: null
examples:
- code: "virt: name=alpha state=running"
description: "Example from Ansible Playbooks"
- code: ansible host -m virt -a "name=alpha command=status"
description: "Example guest management with C(/usr/bin/ansible)"
- code: ansible host -m virt -a "name=alpha command=get_xml"
description: "Use C(/usr/bin/ansible) to get the xml of the guest machine alpha"
- code: ansible host -m virt -a "name=alpha command=create uri=lxc:///"
requirements: [ "libvirt" ]
author: Michael DeHaan, Seth Vidal
'''
EXAMPLES = '''
# a playbook task line:
tasks:
- 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:///
'''
VIRT_FAILED = 1
VIRT_SUCCESS = 0
VIRT_UNAVAILABLE=2