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

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 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

2 participants