New in version 2.2.
Uses pyvmomi to ... copy a template to a new virtualmachine poweron/poweroff/restart a virtualmachine remove a virtualmachine
parameter | required | default | choices | comments |
---|---|---|---|---|
datacenter | yes | Destination datacenter for the deploy operation |
||
disk | no | A list of disks to add |
||
esxi_hostname | yes | The esxi hostname where the VM will run. |
||
folder | no | Destination folder path for the new guest |
||
force | no | Ignore warnings and complete the actions |
||
hardware | no | Attributes such as cpus, memory, osid, and disk controller |
||
hostname | yes | The hostname or IP address of the vSphere vCenter. |
||
name | yes | Name of the newly deployed guest |
||
name_match | no | first |
| If multiple vms matching the name, use the first or last found |
nic | no | A list of nics to add |
||
password | yes |
The password of the vSphere vCenter. aliases: pass, pwd
|
||
state | yes |
| What state should the virtualmachine be in? |
|
template | no |
Name of the template to deploy, if needed to create the guest (state=present).
If the guest exists already this setting will be ignored.
|
||
username | yes |
The username of the vSphere vCenter. aliases: user, admin
|
||
uuid | no |
UUID of the instance to manage if known, this is vmware's unique identifier.
This is required if name is not supplied.
|
||
validate_certs | no | True |
| Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted. |
wait_for_ip_address | no | Wait until vcenter detects an IP address for the guest |
Example from Ansible playbook # # Create a VM from a template # - name: create the VM vmware_guest: validate_certs: False hostname: 192.0.2.44 username: [email protected] password: vmware name: testvm_2 state: poweredon folder: testvms disk: - size_gb: 10 type: thin datastore: g73_datastore nic: - type: vmxnet3 network: VM Network network_type: standard hardware: memory_mb: 512 num_cpus: 1 osid: centos64guest scsi: paravirtual datacenter: datacenter1 esxi_hostname: 192.0.2.117 template: template_el7 wait_for_ip_address: yes register: deploy # # Gather facts only # - name: gather the VM facts vmware_guest: validate_certs: False hostname: 192.168.1.209 username: [email protected] password: vmware name: testvm_2 esxi_hostname: 192.168.1.117 register: facts
Common return values are documented here Common Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
instance | always | dict | None |
Note
Tested on vSphere 6.0
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, developing_test_pr and Developing Modules.
© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/vmware_guest_module.html