community / community.vmware / 4.2.0 / module / vmware_guest Manages virtual machines in vCenter Authors: Loic Blot (@nerzhul) <loic.blot@unix-experience.fr>, Philippe Dellaert (@pdellaert) <philippe@dellaert.org>, Abhijeet Kasurde (@Akasurde) <akasurde@redhat.com>community.vmware.vmware_guest (4.2.0) — module
Install with ansible-galaxy collection install community.vmware:==4.2.0
collections: - name: community.vmware version: 4.2.0
This module can be used to create new virtual machines from templates or other virtual machines, manage power state of virtual machine such as power on, power off, suspend, shutdown, reboot, restart etc., modify various virtual machine components like network, disk, customization etc., rename a virtual machine and remove a virtual machine with associated components.
- name: Create a virtual machine on given ESXi hostname community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" folder: /DC1/vm/ name: test_vm_0001 state: poweredon guest_id: centos64Guest # This is hostname of particular ESXi server on which user wants VM to be deployed esxi_hostname: "{{ esxi_hostname }}" disk: - size_gb: 10 type: thin datastore: datastore1 hardware: memory_mb: 512 num_cpus: 4 scsi: paravirtual networks: - name: VM Network mac: aa:bb:dd:aa:00:14 ip: 10.10.10.100 netmask: 255.255.255.0 device_type: vmxnet3 wait_for_ip_address: true wait_for_ip_address_timeout: 600 delegate_to: localhost register: deploy_vm
- name: Create a virtual machine from a template community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" folder: /testvms name: testvm_2 state: poweredon template: template_el7 disk: - size_gb: 10 type: thin datastore: g73_datastore # Add another disk from an existing VMDK - filename: "[datastore1] testvms/testvm_2_1/testvm_2_1.vmdk" hardware: memory_mb: 512 num_cpus: 6 num_cpu_cores_per_socket: 3 scsi: paravirtual memory_reservation_lock: true mem_limit: 8096 mem_reservation: 4096 cpu_shares_level: "high" mem_shares_level: "high" cpu_limit: 8096 cpu_reservation: 4096 max_connections: 5 hotadd_cpu: true hotremove_cpu: true hotadd_memory: false version: 12 # Hardware version of virtual machine boot_firmware: "efi" cdrom: - controller_number: 0 unit_number: 0 state: present type: iso iso_path: "[datastore1] livecd.iso" networks: - name: VM Network mac: aa:bb:dd:aa:00:14 wait_for_ip_address: true delegate_to: localhost register: deploy
- name: Clone a virtual machine from Windows template and customize community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" datacenter: datacenter1 cluster: cluster name: testvm-2 template: template_windows networks: - name: VM Network ip: 192.168.1.100 netmask: 255.255.255.0 gateway: 192.168.1.1 mac: aa:bb:dd:aa:00:14 domain: my_domain dns_servers: - 192.168.1.1 - 192.168.1.2 - vlan: 1234 type: dhcp customization: autologon: true dns_servers: - 192.168.1.1 - 192.168.1.2 domain: my_domain password: new_vm_password runonce: - powershell.exe -ExecutionPolicy Unrestricted -File C:\Windows\Temp\ConfigureRemotingForAnsible.ps1 -ForceNewSSLCert -EnableCredSSP delegate_to: localhost
- name: Clone a virtual machine from Linux template and customize community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" datacenter: "{{ datacenter }}" state: present folder: /DC1/vm template: "{{ template }}" name: "{{ vm_name }}" cluster: DC1_C1 networks: - name: VM Network ip: 192.168.10.11 netmask: 255.255.255.0 wait_for_ip_address: true customization: domain: "{{ guest_domain }}" dns_servers: - 8.9.9.9 - 7.8.8.9 dns_suffix: - example.com - example2.com script_text: | #!/bin/bash touch /tmp/touch-from-playbook delegate_to: localhost
- name: Rename a virtual machine (requires the virtual machine's uuid) community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" uuid: "{{ vm_uuid }}" name: new_name state: present delegate_to: localhost
- name: Remove a virtual machine by uuid community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" uuid: "{{ vm_uuid }}" state: absent delegate_to: localhost
- name: Remove a virtual machine from inventory community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" name: vm_name delete_from_inventory: true state: absent delegate_to: localhost
- name: Manipulate vApp properties community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" name: vm_name state: present vapp_properties: - id: remoteIP category: Backup label: Backup server IP type: string value: 10.10.10.1 - id: old_property operation: remove delegate_to: localhost
- name: Set powerstate of a virtual machine to poweroff by using UUID community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" uuid: "{{ vm_uuid }}" state: poweredoff delegate_to: localhost
- name: Deploy a virtual machine in a datastore different from the datastore of the template community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" name: "{{ vm_name }}" state: present template: "{{ template_name }}" # Here datastore can be different which holds template datastore: "{{ virtual_machine_datastore }}" hardware: memory_mb: 512 num_cpus: 2 scsi: paravirtual delegate_to: localhost
- name: Create a diskless VM community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" datacenter: "{{ dc1 }}" state: poweredoff cluster: "{{ ccr1 }}" name: diskless_vm folder: /Asia-Datacenter1/vm guest_id: centos64Guest datastore: "{{ ds1 }}" hardware: memory_mb: 1024 num_cpus: 2 num_cpu_cores_per_socket: 1
- name: Create a VM with multiple disks of different disk controller types community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" folder: /DC1/vm/ name: test_vm_multi_disks state: poweredoff guest_id: centos64Guest datastore: datastore1 disk: - size_gb: 10 controller_type: 'nvme' controller_number: 0 unit_number: 0 - size_gb: 10 controller_type: 'paravirtual' controller_number: 0 unit_number: 1 - size_gb: 10 controller_type: 'sata' controller_number: 0 unit_number: 2 hardware: memory_mb: 512 num_cpus: 4 version: 14 networks: - name: VM Network device_type: vmxnet3 delegate_to: localhost register: deploy_vm
- name: Create a VM with NVDIMM device community.vmware.vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" folder: /DC1/vm/ name: test_vm_nvdimm state: poweredoff guest_id: centos7_64Guest datastore: datastore1 hardware: memory_mb: 512 num_cpus: 4 version: 14 networks: - name: VM Network device_type: vmxnet3 nvdimm: state: present size_mb: 2048 delegate_to: localhost register: deploy_vm
disk: default: [] description: - A list of disks to add. - This parameter is case sensitive. - Shrinking disks is not supported. - Removing existing disks of the virtual machine is not supported. - Attributes O(disk.controller_type), O(disk.controller_number), O(disk.unit_number) are used to configure multiple types of disk controllers and disks for creating or reconfiguring virtual machine. elements: dict suboptions: autoselect_datastore: description: - Select the less used datastore. - O(disk.datastore) and O(disk.autoselect_datastore) will not be used if O(datastore) is specified outside this O(disk) configuration. type: bool controller_number: choices: - 0 - 1 - 2 - 3 description: - Disk controller bus number. - The maximum number of same type controller is 4 per VM. type: int controller_type: choices: - buslogic - lsilogic - lsilogicsas - paravirtual - sata - nvme description: - Type of disk controller. Set this type on not supported ESXi or VM hardware version will lead to failure in deployment. - When set to V(sata), please make sure O(disk.unit_number) is correct and not used by SATA CDROMs. - If set to V(sata) type, please make sure O(disk.controller_number) and O(disk.unit_number) are set correctly when O(cdrom=sata). type: str datastore: description: - The name of datastore which will be used for the disk. - If O(disk.autoselect_datastore) is set to True, will select the less used datastore whose name contains this "disk.datastore" string. type: str disk_mode: choices: - persistent - independent_persistent - independent_nonpersistent description: - Type of disk mode. - If V(persistent) specified, changes are immediately and permanently written to the virtual disk. This is default. - If V(independent_persistent) specified, same as persistent, but not affected by snapshots. - If V(independent_nonpersistent) specified, changes to virtual disk are made to a redo log and discarded at power off, but not affected by snapshots. type: str filename: description: - Existing disk image to be used. - Filename must already exist on the datastore. - Specify filename string in C([datastore_name] path/to/file.vmdk) format. type: str size: description: - Disk storage size. - Please specify storage unit like [kb, mb, gb, tb]. type: str size_gb: description: Disk storage size in gb. type: int size_kb: description: Disk storage size in kb. type: int size_mb: description: Disk storage size in mb. type: int size_tb: description: Disk storage size in tb. type: int type: choices: - thin - thick - eagerzeroedthick description: - Type of disk. - If not specified, disk type is inherited from the source VM or template when cloned and thick disk, no eagerzero otherwise. type: str unit_number: description: - Disk Unit Number. - Valid value range from 0 to 15 for SCSI controller, except 7. - Valid value range from 0 to 14 for NVME controller. - Valid value range from 0 to 29 for SATA controller. - O(disk.controller_type), O(disk.controller_number) and O(disk.unit_number) are required when creating or reconfiguring VMs with multiple types of disk controllers and disks. - When creating new VM, the first configured disk in the O(disk) list will be "Hard Disk 1". type: int type: list name: description: - Name of the virtual machine to work with. - Virtual machine names in vCenter are not necessarily unique, which may be problematic, see O(name_match). - If multiple virtual machines with same name exists, then O(folder) is required parameter to identify uniqueness of the virtual machine. - This parameter is required, if O(state=poweredon), O(state=powered-on), O(state=poweredoff), O(state=powered-off), O(state=present), O(state=restarted), O(state=suspended) and virtual machine does not exists. - This parameter is case sensitive. type: str port: default: 443 description: - The port number of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable E(VMWARE_PORT) will be used instead. type: int uuid: description: - UUID of the virtual machine to manage if known, this is VMware's unique identifier. - This is required if O(name) is not supplied. - If virtual machine does not exists, then this parameter is ignored. - Please note that a supplied UUID will be ignored on virtual machine creation, as VMware creates the UUID internally. type: str cdrom: default: [] description: - A list of CD-ROM configurations for the virtual machine. - For V(ide) controller, hot-add or hot-remove CD-ROM is not supported. elements: dict suboptions: controller_number: description: - For O(cdrom.controller_type=ide), valid value is 0 or 1. - For O(cdrom.controller_type=sata), valid value is 0 to 3. type: int controller_type: choices: - ide - sata default: ide description: - When set to V(sata), please make sure O(cdrom.unit_number) is correct and not used by SATA disks. type: str iso_path: description: - The datastore path to the ISO file to use, in the form of C([datastore1] path/to/file.iso). - Required if type is set V(iso). type: str state: choices: - present - absent default: present description: - If set to V(absent), then the specified CD-ROM will be removed. type: str type: choices: - none - client - iso default: client description: - The type of CD-ROM. - With V(none) the CD-ROM will be disconnected but present. type: str unit_number: description: - For O(cdrom.controller_type=ide), valid value is 0 or 1. - For O(cdrom.controller_type=sata), valid value is 0 to 29. - O(cdrom.controller_number) and O(cdrom.unit_number) are mandatory attributes. type: int type: list force: default: false description: - Ignore warnings and complete the actions. - This parameter is useful while removing virtual machine which is powered on state. - This module reflects the VMware vCenter API and UI workflow, as such, in some cases the `force` flag will be mandatory to perform the action to ensure you are certain the action has to be taken, no matter what the consequence. This is specifically the case for removing a powered on the virtual machine when O(state=absent). type: bool state: choices: - absent - poweredon - powered-on - poweredoff - powered-off - present - rebootguest - reboot-guest - restarted - suspended - shutdownguest - shutdown-guest default: present description: - Specify the state the virtual machine should be in. - If V(present) and virtual machine exists, ensure the virtual machine configurations conforms to task arguments. - If V(absent) and virtual machine exists, then the specified virtual machine is removed with it's associated components. - If set to one of V(poweredon), V(powered-on), V(poweredoff), V(powered-off), V(present), V(restarted), V(suspended) and virtual machine does not exists, virtual machine is deployed with the given parameters. - If set to V(poweredon) or V(powered-on) and virtual machine exists with powerstate other than powered on, then the specified virtual machine is powered on. - If set to V(poweredoff) or V(powered-off) and virtual machine exists with powerstate other than powered off, then the specified virtual machine is powered off. - If set to V(restarted) and virtual machine exists, then the virtual machine is restarted. - If set to V(suspended) and virtual machine exists, then the virtual machine is set to suspended mode. - If set to V(shutdownguest) or V(shutdown-guest) and virtual machine exists, then the virtual machine is shutdown. - If set to V(rebootguest) or V(reboot-guest) and virtual machine exists, then the virtual machine is rebooted. type: str folder: description: - Destination folder, absolute path to find an existing guest or create the new guest. - The folder should include the datacenter. ESXi's datacenter is ha-datacenter. - This parameter is case sensitive. - If multiple machines are found with same name, this parameter is used to identify - uniqueness of the virtual machine. - 'Examples:' - ' folder: /ha-datacenter/vm' - ' folder: ha-datacenter/vm' - ' folder: /datacenter1/vm' - ' folder: datacenter1/vm' - ' folder: /datacenter1/vm/folder1' - ' folder: datacenter1/vm/folder1' - ' folder: /folder1/datacenter1/vm' - ' folder: folder1/datacenter1/vm' - ' folder: /folder1/datacenter1/vm/folder2' type: str nvdimm: default: {} description: - Add or remove a virtual NVDIMM device to the virtual machine. - VM virtual hardware version must be 14 or higher on vSphere 6.7 or later. - Verify that guest OS of the virtual machine supports PMem before adding virtual NVDIMM device. - Verify that you have the I(Datastore.Allocate) space privilege on the virtual machine. - Make sure that the host or the cluster on which the virtual machine resides has available PMem resources. - To add or remove virtual NVDIMM device to the existing virtual machine, it must be in power off state. suboptions: label: description: - The label of the virtual NVDIMM device to be removed or configured, e.g., "NVDIMM 1". - This parameter is required when O(nvdimm.state=absent), or O(nvdimm.state=present) to reconfigure NVDIMM device size. When add a new device, please do not set. type: str size_mb: default: 1024 description: Virtual NVDIMM device size in MB. type: int state: choices: - present - absent description: - If set to V(absent), then the NVDIMM device with specified O(nvdimm.label) will be removed. type: str type: dict cluster: description: - The cluster name where the virtual machine will run. - This is a required parameter, if O(esxi_hostname) is not set. - O(esxi_hostname) and O(cluster) are mutually exclusive parameters. - This parameter is case sensitive. type: str convert: choices: - thin - thick - eagerzeroedthick description: - Specify convert disk type while cloning template or virtual machine. type: str guest_id: description: - Set the guest ID. - This parameter is case sensitive. - This field is required when creating a virtual machine, not required when creating from the template. - 'Valid values are referenced here: U(https://code.vmware.com/apis/358/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html) ' type: str hardware: default: {} description: - Manage virtual machine's hardware attributes. - All parameters case sensitive. suboptions: boot_firmware: choices: - bios - efi description: Choose which firmware should be used to boot the virtual machine. type: str cpu_limit: description: - The CPU utilization of a virtual machine will not exceed this limit. - Unit is MHz. type: int cpu_reservation: description: The amount of CPU resource that is guaranteed available to the virtual machine. type: int cpu_shares: description: - The number of shares of CPU allocated to this virtual machine - cpu_shares_level will automatically be set to 'custom' type: int version_added: 3.2.0 version_added_collection: community.vmware cpu_shares_level: choices: - low - normal - high - custom description: - The allocation level of CPU resources for the virtual machine. type: str version_added: 3.2.0 version_added_collection: community.vmware hotadd_cpu: description: Allow virtual CPUs to be added while the virtual machine is running. type: bool hotadd_memory: description: Allow memory to be added while the virtual machine is running. type: bool hotremove_cpu: description: Allow virtual CPUs to be removed while the virtual machine is running. type: bool iommu: description: Flag to specify if I/O MMU is enabled for this virtual machine. type: bool max_connections: description: - Maximum number of active remote display connections for the virtual machines. type: int mem_limit: description: - The memory utilization of a virtual machine will not exceed this limit. - Unit is MB. type: int mem_reservation: aliases: - memory_reservation description: The amount of memory resource that is guaranteed available to the virtual machine. type: int mem_shares: description: - The number of shares of memory allocated to this virtual machine - mem_shares_level will automatically be set to 'custom' type: int version_added: 3.2.0 version_added_collection: community.vmware mem_shares_level: choices: - low - normal - high - custom description: - The allocation level of memory resources for the virtual machine. type: str version_added: 3.2.0 version_added_collection: community.vmware memory_mb: description: Amount of memory in MB. type: int memory_reservation_lock: description: - If set V(true), memory resource reservation for the virtual machine. type: bool nested_virt: description: - Enable nested virtualization. type: bool num_cpu_cores_per_socket: description: Number of Cores Per Socket. type: int num_cpus: description: - Number of CPUs. - Must be a multiple of O(hardware.num_cpu_cores_per_socket). - For example, to create a VM with 2 sockets of 4 cores, specify O(hardware.num_cpus) as 8 and O(hardware.num_cpu_cores_per_socket) as 4. type: int scsi: choices: - buslogic - lsilogic - lsilogicsas - paravirtual description: - Valid values are V(buslogic), V(lsilogic), V(lsilogicsas) and V(paravirtual). - V(paravirtual) is default. type: str secure_boot: description: Whether to enable or disable (U)EFI secure boot. type: bool version: description: - The Virtual machine hardware versions. - Default is 10 (ESXi 5.5 and onwards). - If set to V(latest), the specified virtual machine will be upgraded to the most current hardware version supported on the host. - Please check VMware documentation for correct virtual machine hardware version. - Incorrect hardware version may lead to failure in deployment. If hardware version is already equal to the given. type: str virt_based_security: description: - Enable Virtualization Based Security feature for Windows on ESXi 6.7 and later, from hardware version 14. - Supported Guest OS are Windows 10 64 bit, Windows Server 2016, Windows Server 2019 and later. - The firmware of virtual machine must be EFI and secure boot must be enabled. - Virtualization Based Security depends on nested virtualization and Intel Virtualization Technology for Directed I/O. - Deploy on unsupported ESXi, hardware version or firmware may lead to failure or deployed VM with unexpected configurations. type: bool vpmc_enabled: description: Enable virtual CPU Performance Counters. type: bool version_added: 3.2.0 version_added_collection: community.vmware type: dict hostname: description: - The hostname or IP address of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable E(VMWARE_HOST) will be used instead. type: str networks: default: [] description: - A list of networks (in the order of the NICs). - Removing NICs is not allowed, while reconfiguring the virtual machine. - All parameters and VMware object names are case sensitive. - The I(type), I(ip), I(netmask), I(gateway), I(domain), I(dns_servers) options don't set to a guest when creating a blank new virtual machine. They are set by the customization via vmware-tools. If you want to set the value of the options to a guest, you need to clone from a template with installed OS and vmware-tools(also Perl when Linux). elements: dict suboptions: connected: description: - Indicates whether the NIC is currently connected. type: bool device_type: description: - Virtual network device. - Valid value can be one of C(e1000), C(e1000e), C(pcnet32), C(vmxnet2), C(vmxnet3), C(sriov). - C(vmxnet3) is default. - Optional per entry. - Used for virtual hardware. type: str dns_servers: description: - DNS servers for this network interface (Windows). - Optional per entry. - Used for OS customization. type: str domain: description: - Domain name for this network interface (Windows). - Optional per entry. - Used for OS customization. type: str dvswitch_name: description: - Name of the distributed vSwitch. - Optional per entry. - Used for virtual hardware. type: str gateway: description: - Static gateway. - Optional per entry. - Used for OS customization. type: str gatewayv6: description: - Static gateway. - Optional per entry. - Used for OS customization. type: str version_added: 4.1.0 version_added_collection: community.vmware ip: description: - Static IP address. Implies C(type=static). - Optional per entry. - Used for OS customization. type: str ipv6: description: - Static IP address. Implies C(type=static). - Optional per entry. - Used for OS customization. type: str version_added: 4.1.0 version_added_collection: community.vmware mac: description: - Customize MAC address. - Optional per entry. - Used for virtual hardware. type: str name: description: - Name of the portgroup or distributed virtual portgroup for this interface. - Required per entry. - When specifying distributed virtual portgroup make sure given O(esxi_hostname) or O(cluster) is associated with it. type: str netmask: description: - Static netmask required for C(ip). - Optional per entry. - Used for OS customization. type: str netmaskv6: description: - Static netmask required for C(ip). - Optional per entry. - Used for OS customization. type: str version_added: 4.1.0 version_added_collection: community.vmware start_connected: description: - Specifies whether or not to connect the device when the virtual machine starts. type: bool type: description: - Type of IP assignment. - Valid values are one of C(dhcp), C(static). - C(dhcp) is default. - Optional per entry. - Used for OS customization. type: str typev6: description: - Type of IP assignment. - Valid values are one of C(dhcp), C(static). - C(dhcp) is default. - Optional per entry. - Used for OS customization. type: str version_added: 4.1.0 version_added_collection: community.vmware vlan: description: - VLAN number for this interface. - Required per entry. type: int type: list password: aliases: - pass - pwd description: - The password of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable E(VMWARE_PASSWORD) will be used instead. type: str template: aliases: - template_src description: - Template or existing virtual machine used to create new virtual machine. - If this value is not set, virtual machine is created without using a template. - If the virtual machine already exists, this parameter will be ignored. - This parameter is case sensitive. - From version 2.8 onwards, absolute path to virtual machine or template can be used. type: str username: aliases: - admin - user description: - The username of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable E(VMWARE_USER) will be used instead. type: str datastore: description: - Specify datastore or datastore cluster to provision virtual machine. - This parameter takes precedence over O(disk.datastore) parameter. - This parameter can be used to override datastore or datastore cluster setting of the virtual machine when deployed from the template. - Please see example for more usage. type: str annotation: aliases: - notes description: - A note or annotation to include in the virtual machine. type: str datacenter: default: ha-datacenter description: - Destination datacenter for the deploy operation. - This parameter is case sensitive. type: str encryption: default: {} description: - Manage virtual machine encryption settings - All parameters case sensitive. suboptions: encrypted_ft: choices: - disabled - opportunistic - required description: Controls encryption for fault tolerance replication type: str encrypted_vmotion: choices: - disabled - opportunistic - required description: Controls encryption for live migrations with vmotion type: str type: dict version_added: 3.9.0 version_added_collection: community.vmware name_match: choices: - first - last default: first description: - If multiple virtual machines matching the name, use the first or last found. type: str proxy_host: description: - Address of a proxy that will receive all HTTPS requests and relay them. - The format is a hostname or a IP. - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_HOST) will be used instead. required: false type: str proxy_port: description: - Port of the HTTP proxy that will receive all HTTPS requests and relay them. - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_PORT) will be used instead. required: false type: int is_template: default: false description: - Flag the instance as a template. - This will mark the given virtual machine as template. - Note, this may need to be done in a dedicated task invocation that is not making any other changes. For example, user cannot change the state from powered-on to powered-off AND save as template in the same task. - See M(community.vmware.vmware_guest) source for more details. type: bool customvalues: default: [] description: - Define a list of custom values to set on virtual machine. - A custom value object takes the two fields C(key) and C(value). - Incorrect key and values will be ignored. elements: dict type: list linked_clone: default: false description: - Whether to create a linked clone from the snapshot specified. - If specified, then O(snapshot_src) is required parameter. type: bool snapshot_src: description: - Name of the existing snapshot to use to create a clone of a virtual machine. - This parameter is case sensitive. - While creating linked clone using O(linked_clone) parameter, this parameter is required. type: str customization: default: {} description: - Parameters for OS customization when cloning from the template or the virtual machine, or apply to the existing virtual machine directly. - Not all operating systems are supported for customization with respective vCenter version, please check VMware documentation for respective OS customization. - For supported customization operating system matrix, (see U(http://partnerweb.vmware.com/programs/guestOS/guest-os-customization-matrix.pdf)) - All parameters and VMware object names are case sensitive. - Linux based OSes requires Perl package to be installed for OS customizations. suboptions: autologon: description: - Auto logon after virtual machine customization. - Specific to Windows customization. type: bool autologoncount: description: - Number of autologon after reboot. - Specific to Windows customization. - Ignored if O(customization.autologon) is unset or set to O(customization.autologon=false). - If unset, 1 will be used. type: int dns_servers: description: - List of DNS servers to configure. - Common for Linux and Windows customization. elements: str type: list dns_suffix: description: - List of domain suffixes, also known as DNS search path. - Default C(domain) parameter. - Common for Linux and Windows customization. elements: str type: list domain: description: - DNS domain name to use. - Common for Linux and Windows customization. type: str domainadmin: description: - User used to join in AD domain. - Required if O(customization.joindomain) specified. - Specific to Windows customization. type: str domainadminpassword: description: - Password used to join in AD domain. - Required if O(customization.joindomain) specified. - Specific to Windows customization. type: str existing_vm: description: - If set to V(true), do OS customization on the specified virtual machine directly. - Common for Linux and Windows customization. type: bool fullname: description: - Server owner name. - Specific to Windows customization. - If unset, "Administrator" will be used as a fall-back. type: str hostname: description: - Computer hostname. - Default is shortened O(name) parameter. - Allowed characters are alphanumeric (uppercase and lowercase) and minus, rest of the characters are dropped as per RFC 952. - Common for Linux and Windows customization. type: str hwclockUTC: description: - Specifies whether the hardware clock is in UTC or local time. - Specific to Linux customization. type: bool joindomain: description: - AD domain to join. - Not compatible with O(customization.joinworkgroup). - Specific to Windows customization. type: str joinworkgroup: description: - Workgroup to join. - Not compatible with O(customization.joindomain). - Specific to Windows customization. - If unset, "WORKGROUP" will be used as a fall-back. type: str orgname: description: - Organisation name. - Specific to Windows customization. - If unset, "ACME" will be used as a fall-back. type: str password: description: - Local administrator password. - If not defined, the password will be set to blank (that is, no password). - Specific to Windows customization. type: str productid: description: - Product ID. - Specific to Windows customization. type: str runonce: description: - List of commands to run at first user logon. - Specific to Windows customization. elements: str type: list script_text: description: - Script to run with shebang. - Needs to be enabled in vmware tools with vmware-toolbox-cmd config set deployPkg enable-custom-scripts true - https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-9A5093A5-C54F-4502-941B-3F9C0F573A39.html - Specific to Linux customization. type: str version_added: 3.1.0 version_added_collection: community.vmware timezone: description: - Timezone. - See List of supported time zones for different vSphere versions in Linux/Unix. - Common for Linux and Windows customization. - L(Windows, https://msdn.microsoft.com/en-us/library/ms912391.aspx). type: str type: dict esxi_hostname: description: - The ESXi hostname where the virtual machine will run. - This is a required parameter, if O(cluster) is not set. - O(esxi_hostname) and O(cluster) are mutually exclusive parameters. - This parameter is case sensitive. type: str resource_pool: description: - Use the given resource pool for virtual machine operation. - This parameter is case sensitive. - Resource pool should be child of the selected host parent. - When not specified I(Resources) is taken as default value. type: str validate_certs: default: true description: - Allows connection when SSL certificates are not valid. Set to V(false) when certificates are not trusted. - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS) will be used instead. type: bool vapp_properties: default: [] description: - A list of vApp properties. - 'For full list of attributes and types refer to: U(https://code.vmware.com/apis/704/vsphere/vim.vApp.PropertyInfo.html)' elements: dict suboptions: id: description: - Property ID. - Required per entry. type: str operation: description: - The C(remove) attribute is required only when removing properties. type: str type: description: - Value type, string type by default. type: str value: description: - Property value. type: str type: list advanced_settings: default: [] description: - Define a list of advanced settings to be added to the VMX config. - An advanced settings object takes the two fields C(key) and C(value). - Incorrect key and values will be ignored. elements: dict type: list use_instance_uuid: default: false description: - Whether to use the VMware instance UUID rather than the BIOS UUID. type: bool customization_spec: description: - Unique name identifying the requested customization specification. - This parameter is case sensitive. - If set, then overrides O(customization) parameter values. type: str wait_for_ip_address: default: false description: - Wait until vCenter detects an IP address for the virtual machine. - This requires vmware-tools (vmtoolsd) to properly work after creation. - vmware-tools needs to be installed on the given virtual machine in order to work with this parameter. type: bool state_change_timeout: default: 0 description: - If the O(state=shutdownguest), by default the module will return immediately after sending the shutdown signal. - If this argument is set to a positive integer, the module will instead wait for the virtual machine to reach the poweredoff state. - The value sets a timeout in seconds for the module to wait for the state change. type: int delete_from_inventory: default: false description: - Whether to delete Virtual machine from inventory or delete from disk. type: bool wait_for_customization: default: false description: - Wait until vCenter detects all guest customizations as successfully completed. - When enabled, the VM will automatically be powered on. - If vCenter does not detect guest customization start or succeed, failed events after time O(wait_for_customization_timeout) parameter specified, warning message will be printed and task result is fail. type: bool wait_for_ip_address_timeout: default: '300' description: - Define a timeout (in seconds) for the wait_for_ip_address parameter. type: int wait_for_customization_timeout: default: '3600' description: - Define a timeout (in seconds) for the wait_for_customization parameter. - Be careful when setting this value since the time guest customization took may differ among guest OSes. type: int
instance: description: metadata about the new virtual machine returned: always sample: None type: dict