vmware_guest_file_operation – Files operation in a VMware guest operating system without network¶
New in version 2.5.
Synopsis¶
- Module to copy a file to a VM, fetch a file from a VM and create or delete a directory in the guest OS.
Requirements¶
The below requirements are needed on the host that executes this module.
- python >= 2.6
- PyVmomi
- requests
Parameters¶
Notes¶
Note
- Tested on vSphere 6
- Only the first match against vm_id is used, even if there are multiple matches
Examples¶
- name: Create directory inside a vm
vmware_guest_file_operation:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
validate_certs: no
vm_id: "{{ guest_name }}"
vm_username: "{{ guest_username }}"
vm_password: "{{ guest_userpassword }}"
directory:
path: "/test"
operation: create
recurse: no
delegate_to: localhost
- name: copy file to vm
vmware_guest_file_operation:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
vm_id: "{{ guest_name }}"
vm_username: "{{ guest_username }}"
vm_password: "{{ guest_userpassword }}"
copy:
src: "files/test.zip"
dest: "/root/test.zip"
overwrite: False
delegate_to: localhost
- name: fetch file from vm
vmware_guest_file_operation:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
vm_id: "{{ guest_name }}"
vm_username: "{{ guest_username }}"
vm_password: "{{ guest_userpassword }}"
fetch:
src: "/root/test.zip"
dest: "files/test.zip"
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¶
- Stéphane Travassac (@stravassac)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.