“vmware_guest_file_operation” copy file from VM without network
To install it use:
ansible-galaxy collection install community.vmware.
To use it in a playbook, specify:
I create playbook to create some folder on virtual machines.
Option 1 Create folder inside VM
download playbook >> FileOperationalInsideVm
- Playbook looks like below. Lets test it.
2. I run playbook by command and looks like it working.
3. I login to windows server and check if folder was created.
Option 2 copy file between VM’s
Let test different option with copy files.
download playbook >> CopyFile
- I made small modification by adding copy line (source and destination).
2. I start this playbook by run command ansible-playbook ansible/CopyFile.yml
3. I login to windows server and check if File.7z was copy. File was copy without any problems.
Option 3 copy file from VM without network
This sound interesting so I decided to test is.
Module vmware_guest_file_operation has parameter fetch witch in theory should allow you to copy files from virtual server without network.
download playbook >> FetchCopy
- I create ne folder “FetchTest” and create file FileFetch.7z
2. Untick network settings on virtual machine windows225.
3. Playbook have new parameter call fetch.
4. I run playbook by command ansible-playbook ansible/FetchCopy.yml
5. I simply test by type ls command on my ansible server. This is interesting because sometimes you need to restore some file from server but you cannot run it with network.
I specially if you restore some database or domain controller :).
Please Comment and Subscribe
759 total views, 2 views today