vmware_tools – Execute tasks inside a VM via VMware Tools¶
New in version 2.8.
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
topowershell
.Does not work with ‘become’.
Requirements¶
The below requirements are needed on the local master node that executes this connection.
pyvmomi (Python library)
requests (Python library)
Parameters¶
Examples¶
# example vars.yml
---
ansible_connection: vmware_tools
ansible_vmware_host: vcenter.example.com
ansible_vmware_user: administrator@vsphere.local
ansible_vmware_password: Secr3tP4ssw0rd!12
ansible_vmware_validate_certs: no # default is yes
# vCenter Connection VM Path Example
ansible_vmware_guest_path: DATACENTER/vm/FOLDER/{{ inventory_hostname }}
# ESXi Connection VM Path Example
ansible_vmware_guest_path: ha-datacenter/vm/{{ inventory_hostname }}
ansible_vmware_tools_user: root
ansible_vmware_tools_password: MyR00tPassw0rD
# if the target VM guest is Windows set the 'ansible_shell_type' to 'powershell'
ansible_shell_type: powershell
# example playbook_linux.yml
---
- name: Test VMware Tools Connection Plugin for Linux
hosts: linux
tasks:
- command: whoami
- ping:
- copy:
src: foo
dest: /home/user/foo
- fetch:
src: /home/user/foo
dest: linux-foo
flat: yes
- file:
path: /home/user/foo
state: absent
# example playbook_windows.yml
---
- name: Test VMware Tools Connection Plugin for Windows
hosts: windows
tasks:
- win_command: whoami
- win_ping:
- win_copy:
src: foo
dest: C:\Users\user\foo
- fetch:
src: C:\Users\user\foo
dest: windows-foo
flat: yes
- win_file:
path: C:\Users\user\foo
state: absent
Status¶
This connection is not guaranteed to have a backwards compatible interface. [preview]
This connection is maintained by the Ansible Community. [community]
Authors¶
Deric Crago <deric.crago@gmail.com>
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
Hint
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.