vsphere_file – Manage files on a vCenter datastore
vsphere_file – Manage files on a vCenter datastore
New in version 2.8.
Synopsis
- Manage files on a vCenter datastore.
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
datacenter string / required |
The datacenter on the vCenter server that holds the datastore. | |
datastore string / required |
The datastore on the vCenter server to push files to. | |
host string / required |
The vCenter server on which the datastore is available.
| |
password string / required |
The password to authenticate on the vCenter server. | |
path string / required |
The file or directory on the datastore on the vCenter server.
| |
state string |
|
The state of or the action on the provided path. If If If If |
timeout integer |
Default: 10 |
The timeout in seconds for the upload to the datastore. |
username string / required |
The user name to authenticate on the vCenter server. | |
validate_certs boolean |
|
If |
Notes
Note
- The vSphere folder API does not allow to remove directory objects.
Examples
- name: Create an empty file on a datastore
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
vsphere_copy:
host: '{{ vhost }}'
username: '{{ vuser }}'
password: '{{ vpass }}'
src: /other/local/file
datacenter: DC2 Someplace
datastore: datastore2
path: other/remote/file
state: directory
delegate_to: localhost
- name: Query a file on a datastore
vsphere_file:
host: '{{ vhost }}'
username: '{{ vuser }}'
password: '{{ vpass }}'
datacenter: DC1 Someplace
datastore: datastore1
path: some/remote/file
state: touch
delegate_to: localhost
ignore_errors: yes
- name: Delete a file on a datastore
vsphere_copy:
host: '{{ vhost }}'
username: '{{ vuser }}'
password: '{{ vpass }}'
datacenter: DC2 Someplace
datastore: datastore2
path: other/remote/file
state: absent
delegate_to: localhost
Status
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors
- Dag Wieers (@dagwieers)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.8/modules/vsphere_file_module.html