community.vmware.vmware_tools – Execute tasks inside a VM via VMware Tools

Note

This plugin is part of the community.vmware collection (version 1.17.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.vmware.

To use it in a playbook, specify: community.vmware.vmware_tools.

Synopsis

  • Use VMware tools to run tasks in, or put/fetch files to guest operating systems running in VMware infrastructure.

  • In case of Windows VMs, set ansible_shell_type to powershell.

  • Does not work with ‘become’.

Requirements

The below requirements are needed on the local controller node that executes this connection.

  • pyvmomi (Python library)

  • requests (Python library)

Parameters

Parameter Choices/Defaults Configuration Comments
exec_command_sleep_interval
float
Default:
0.5
var: ansible_vmware_tools_exec_command_sleep_interval
Time in seconds to sleep between execution of command.
executable
string
Default:
"/bin/sh"
ini entries:

[defaults]
executable = /bin/sh

env:ANSIBLE_EXECUTABLE
var: ansible_executable
var: ansible_vmware_tools_executable
shell to use for execution inside container
file_chunk_size
integer
Default:
128
var: ansible_vmware_tools_file_chunk_size
File chunk size.
(Applicable when writing a file to disk, example: using the fetch module.)
validate_certs
boolean
    Choices:
  • no
  • yes ←
env:VMWARE_VALIDATE_CERTS
var: ansible_vmware_validate_certs
Verify SSL for the connection.
Note: This will validate certs for both vmware_host and the ESXi host running the VM.
vm_password
string / required
var: ansible_password
var: ansible_vmware_tools_password
Password for the user in guest operating system.
vm_path
string / required
var: ansible_vmware_guest_path
VM path absolute to the connection.
vCenter Example: Datacenter/vm/Discovered virtual machine/testVM.
ESXi Host Example: ha-datacenter/vm/testVM.
Must include VM name, appended to 'folder' as would be passed to community.vmware.vmware_guest.
Needs to include vm between the Datacenter and the rest of the VM path.
Datacenter default value for ESXi server is ha-datacenter.
Folder vm is not visible in the vSphere Web Client but necessary for VMware API to work.
vm_user
string / required
var: ansible_user
var: ansible_vmware_tools_user
VM username.
vmware_host
string / required
env:VI_SERVER
env:VMWARE_HOST
var: ansible_host
var: ansible_vmware_host
FQDN or IP Address for the connection (vCenter or ESXi Host).
vmware_password
string / required
env:VI_PASSWORD
env:VMWARE_PASSWORD
var: ansible_vmware_password
Password for the connection.
vmware_port
string
Default:
443
env:VI_PORTNUMBER
env:VMWARE_PORT
var: ansible_port
var: ansible_vmware_port
Port for the connection.
vmware_user
string / required
env:VI_USERNAME
env:VMWARE_USER
var: ansible_vmware_user
Username for the connection.
Requires the following permissions on the VM: - VirtualMachine.GuestOperations.Execute - VirtualMachine.GuestOperations.Modify - VirtualMachine.GuestOperations.Query

Authors