- 1 year ago
Ansible-AWX get file from remote Windows to local linux
Comment
1 / 1
To retrieve a file from a remote Windows machine to a local Linux machine using Ansible AWX, you can use the win_get
module in Ansible. Here's an example playbook that demonstrates how to accomplish this:
yaml---
- name: Retrieve file from remote Windows to local Linux
hosts: windows_hosts # Replace with the appropriate Windows host group or hostname
gather_facts: false # Disable gathering facts for Windows hosts
tasks:
- name: Get file from remote Windows
win_get:
src: C:\path\to\file.txt # Replace with the path to the file on the remote Windows machine
dest: /path/on/local/linux/file.txt # Replace with the desired destination path on the local Linux machine
delegate_to: localhost
In the above example:
- Replace
windows_hosts
with the appropriate Windows host group or hostname defined in your inventory file. - Modify the
src
parameter to the path of the file you want to retrieve from the remote Windows machine. - Adjust the
dest
parameter to specify the desired destination path on the local Linux machine where you want to save the file.
Run the above playbook using Ansible AWX, ensuring that the target Windows machine is correctly configured in the inventory. The win_get
module will retrieve the specified file from the remote Windows machine and save it to the specified location on the local Linux machine.
Please note that you may need to adjust the playbook and inventory to match your specific environment and ensure that the necessary Windows credentials or authentication methods are configured for accessing the remote Windows hosts.