Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

copy files from linux server to file shared on windows server #318

Open
aakilo opened this issue Sep 26, 2023 · 1 comment
Open

copy files from linux server to file shared on windows server #318

aakilo opened this issue Sep 26, 2023 · 1 comment

Comments

@aakilo
Copy link

aakilo commented Sep 26, 2023

i have created these playfbook and invetory but it does not work when iexecute ansible-playbook -i inventory playbook.yml
inventory :
[windows]
10.x.x.x
[windows:vars]
ansible_user=xxxx
ansible_password=xxxx
ansible_winrm_transport: basic

playbook.yml

  • hosts: windows

    tasks:

    • name: Copy file from switch to Windows server
      win_copy:
      src: "/path/file.txt"
      dest: 'D:\config'
      delegate_to: localhost # Run this task on the Ansible server

what i should add ?????

@softcreations01
Copy link

Try using this correct indentation


  • hosts: windows
    tasks:
    • name: Copy file from switch to Windows server
      win_copy:
      src: "/path/file.txt"
      dest: 'D:\config' # Use double backslashes to escape properly
      delegate_to: localhost # Run this task on the Ansible control machine

Then ensure the following:

  • The ansible_user and ansible_password variables in your inventory file are set correctly with valid Windows credentials.
  • Windows Remote Management (WinRM) is properly configured on the Windows server for Ansible to communicate with it. Make sure that WinRM is enabled and the necessary firewall rules are in place on the Windows server.
  • You have the IP address (10.x.x.x) of your Windows server correctly specified in the inventory file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants