community / community.vmware / 1.18.2 / module / vsphere_file Manage files on a vCenter datastore Authors: Dag Wieers (@dagwieers)community.vmware.vsphere_file (1.18.2) — module
Install with ansible-galaxy collection install community.vmware:==1.18.2
collections: - name: community.vmware version: 1.18.2
Manage files on a vCenter datastore.
- name: Create an empty file on a datastore community.vmware.vsphere_file: host: '{{ vhost }}' username: '{{ vuser }}' password: '{{ vpass }}' datacenter: DC1 Someplace datastore: datastore1 path: some/remote/file state: touch delegate_to: localhost
- name: Create a directory on a datastore community.vmware.vsphere_file: host: '{{ vhost }}' username: '{{ vuser }}' password: '{{ vpass }}' datacenter: DC2 Someplace datastore: datastore2 path: other/remote/file state: directory delegate_to: localhost
- name: Query a file on a datastore community.vmware.vsphere_file: host: '{{ vhost }}' username: '{{ vuser }}' password: '{{ vpass }}' datacenter: DC1 Someplace datastore: datastore1 path: some/remote/file state: file delegate_to: localhost ignore_errors: true
- name: Delete a file on a datastore community.vmware.vsphere_file: host: '{{ vhost }}' username: '{{ vuser }}' password: '{{ vpass }}' datacenter: DC2 Someplace datastore: datastore2 path: other/remote/file state: absent delegate_to: localhost
host: aliases: - hostname description: - The vCenter server on which the datastore is available. required: true type: str path: aliases: - dest description: - The file or directory on the datastore on the vCenter server. required: true type: str state: choices: - absent - directory - file - touch default: file description: - The state of or the action on the provided path. - If C(absent), the file will be removed. - If C(directory), the directory will be created. - If C(file), more information of the (existing) file will be returned. - If C(touch), an empty file will be created if the path does not exist. type: str timeout: default: 10 description: - The timeout in seconds for the upload to the datastore. type: int password: description: - The password to authenticate on the vCenter server. required: true type: str username: description: - The user name to authenticate on the vCenter server. required: true type: str datastore: description: - The datastore on the vCenter server to push files to. required: true type: str datacenter: description: - The datacenter on the vCenter server that holds the datastore. required: true type: str validate_certs: default: true description: - If C(false), SSL certificates will not be validated. This should only be set to C(false) when no other option exists. type: bool