The vsphere_copy module

This module has a single purpose—to copy a local file to a remote data store:

- name: copy file to datastore  vsphere_copy:    hostname: "{{ vsphere_host }}"    username: "{{ vsphere_username }}"    password: "{{ vsphere_password }}"    src: "/path/to/local/file"    datacenter: "my_datacenter"    datastore: "my_datastore"    path: "path/to/remove/file"  transport: local

As you can see, we are copying the file from /path/to/local/file to path/to/remove/file in the my_datastore data store which is hosted in the my_datacenter data center.

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.