# Developing Ansible Pipeline for (Window) shared netwrok

**URL:** <https://forum.ansible.com/t/developing-ansible-pipeline-for-window-shared-netwrok/30194>\
**Category:** Ansible Developer\
**Created:** [April 25, 2019, 7:12pm UTC](https://forum.ansible.com/t/developing-ansible-pipeline-for-window-shared-netwrok/30194 "2019-04-25T19:12:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![benkteshkumar87](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@benkteshkumar87](https://forum.ansible.com/u/benkteshkumar87)\
**Post date:** [April 25, 2019, 7:12pm UTC](https://forum.ansible.com/t/developing-ansible-pipeline-for-window-shared-netwrok/30194/1 "2019-04-25T19:12:34Z")

</div>

Hi,

I have a requirement where the deployment file has to be copied to a window shared network. Jenkins slave is running on Linux server.

We are developing Ansible Playbook to achieve this.

I need help on below points to develop the playbook-

1. How can i connect to the target server(window network)? We already have WINRM enabled to the server. Please find below the Site.yml file-

Site.yml

> **(attachments)**
>
> [SR request.zip](https://forum.ansible.com/uploads/short-url/pnhxogdJrAihF5YiREK0CInNOpF.zip) (374 KB)

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [May 2, 2019, 1:09pm UTC](https://forum.ansible.com/t/developing-ansible-pipeline-for-window-shared-netwrok/30194/2 "2019-05-02T13:09:56Z")

</div>

Hi,

I’d recommend you work through this documentation [https://docs.ansible.com/ansible/latest/user\_guide/windows.html](https://docs.ansible.com/ansible/latest/user_guide/windows.html)

You have a few options for copying files onto a windows file share, although copying to a remotely-mounted file share requires delegated authentication to get around the ‘second hop’ which windows defaults to not allowing (ansible - windows machine being 1 hop and windows machine to machine hosting the shared drive being a second hop) - see [https://docs.ansible.com/ansible/latest/user\_guide/windows\_winrm.html#authentication-options](https://docs.ansible.com/ansible/latest/user_guide/windows_winrm.html#authentication-options) and [https://docs.ansible.com/ansible/latest/user\_guide/windows\_winrm.html#limitations](https://docs.ansible.com/ansible/latest/user_guide/windows_winrm.html#limitations) if that applies to your situation.

If you have access to the machine that is hosting the share you can use the win\_copy module [https://docs.ansible.com/ansible/latest/modules/win\_copy\_module.html](https://docs.ansible.com/ansible/latest/modules/win_copy_module.html).  
This can be slow if you have large files to transfer.

Another option is to use shell or command to run ‘smbclient’. This might be a good option if the source files are on your ansible controller. You might need to use ‘no\_log: true’ to protect the password for the shared drive.

To connect to your windows hosts, you would need to remove the ‘connection:local’ line from your playbook and add the windows machine to a group which is configured to use winrm to connect (instead of using default ssh connection type). If you just have 1 windows host you can use host\_vars instead of group\_vars. The relevant settings are documented here: [https://docs.ansible.com/ansible/latest/user\_guide/windows\_winrm.html#inventory-options](https://docs.ansible.com/ansible/latest/user_guide/windows_winrm.html#inventory-options)

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![benkteshkumar87](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@benkteshkumar87](https://forum.ansible.com/u/benkteshkumar87)\
**Post date:** [May 20, 2019, 3:41pm UTC](https://forum.ansible.com/t/developing-ansible-pipeline-for-window-shared-netwrok/30194/3 "2019-05-20T15:41:06Z")

</div>

Hi Jon,

Thanks for your input.

User(Service account) is now having access to the machine that’s hosting the shared drive. WINRM has been enabled to the target server with CREDSSP authentication. connection has been updated from local to a group.

However now the pipeline is failing while connecting to the target server and it’s giving below error-

_TASK [Gathering Facts]\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*_

_fatal: [test1234p]: UNREACHABLE! =\> {“changed”: false, “msg”: “credssp: The server did not response with a CredSSP token, auth rejected”, “unreachable”: true}_

I have validated below points so far-

1. Service account is working fine and connecting to the target server when tried manually.

2. WINRM is up and running fine and they have remote access. Below commands have been executed to validate this-

Winrm get winrm/config/service

**_winrm quickconfig_**

**_3. Validated the listener and it looks good too. Below commands were use to verify this-_**

winrm e winrm\*\*/ **config** /\*\*Listener

1. The server is listening to port 5986 for HTTPS (i am using https ).

2. PS-Remoting has been enabled for port 5986.

3. It has been verified that powershell4.0 is running on destination server.

Target server is 2008 server.

Could you please let me know what else can i validate now? Do i need to validate something for Ansible setup as well? Not sure if something needs to be validated on server as well?

Note- I have build a pipeline for IIS servers(which is 2012 R2 server) and using the same concept but it’s working fine. The only difference is the service account.  
Regards,  
Benktesh Kumar
