This module was introduced in Ansible 2.5; it allows you to add and fetch files from a VM without the need for the VM to be on a network. It also allows you to create folders within the VM. The following example creates a directory within the VM:
- name: create a directory on a vm vmware_guest_file_operation: hostname: "{{ vsphere_host }}" username: "{{ vsphere_username }}" password: "{{ vsphere_password }}" validate_certs: "no" datacenter: "my-datacenter" vm_id: "yet_another_example_vm" vm_username: "root" vm_password: "supersecretpassword" directory: path: "/tmp/imported/files" operation: "create" recurse: "yes" delegate_to: localhost
The following example copies a file called config.zip from our Ansible ...