Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vsphere_copy: copy files between datastores #2113

Open
drscream opened this issue Jul 11, 2024 · 0 comments
Open

vsphere_copy: copy files between datastores #2113

drscream opened this issue Jul 11, 2024 · 0 comments

Comments

@drscream
Copy link

drscream commented Jul 11, 2024

SUMMARY

vsphere_copy support uploading files to a datastore but it's not possible to copy files between two datastores. It should be nice if vsphere_copy support this. As govc support this feature via datastore.cp I assume the API should provide this feature already.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
vsphere_copy
ADDITIONAL INFORMATION

Ideally the feature is added to vsphere_copy and no extra module is provided. You can see an example below. Both of these examples should not break the existing parameters and functionality of vsphere_copy.

Example 1:

Provide a new parameter datastore_src.

- name: Copy file between datastores using delegate_to
  community.vmware.vsphere_copy:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter: DC1 Someplace
    datastore_src: datastore1
    src: VM-Templates/file1
    datastore: datastore2
    path: some/remote/file
  delegate_to: localhost

Example 2:

Parse the src parameter if it contains a datastore. This is already used in filename for vmware_guest_disk for example:

- name: Copy file between datastores using delegate_to
  community.vmware.vsphere_copy:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter: DC1 
    src: "[Datastore1]/VM-Templates/file1"
    datastore: datastore2
    path: some/remote/file
  delegate_to: localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant