# How can I copy from ansible test to windows file server (samba) without mounting the shared directory

**URL:** <https://forum.ansible.com/t/how-can-i-copy-from-ansible-test-to-windows-file-server-samba-without-mounting-the-shared-directory/4501>\
**Category:** Get Help\
**Tags:** windows\
**Created:** [March 21, 2024, 8:08pm UTC](https://forum.ansible.com/t/how-can-i-copy-from-ansible-test-to-windows-file-server-samba-without-mounting-the-shared-directory/4501 "2024-03-21T20:08:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marseaplage](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/marseaplage/32/2552_2.png) [@marseaplage](https://forum.ansible.com/u/marseaplage)\
**Post date:** [March 21, 2024, 8:08pm UTC](https://forum.ansible.com/t/how-can-i-copy-from-ansible-test-to-windows-file-server-samba-without-mounting-the-shared-directory/4501/1 "2024-03-21T20:08:06Z")

</div>

How can I copy from ansible test to windows file server (samba) without mounting the shared directory

Ansible version: 2.14

```auto
---
- name: Playbook para prueba de file_server
  tags: [file_server, test]
  hosts: windows
  become: false
  gather_facts: true
  tasks:
  - name: Guarda el contenido enviado en un archivo en el file_server incluyendo el timestamp de cuando se generó
    tags: [log_fileserver, archivo_timestamp]
    block:
    - name: Obtiene fecha y hora (timestamp) para el nombre del archivo
      win_shell: Get-Date -UFormat "%Y%m%d-%H%M%S"
      register: timestamp

    - name: Guarda el archivo de log de forma local en el host remoto, colocando un timestamp como parte del nombre del archivo especificado
      ansible.windows.win_copy:   
        content: "prueba de file_server" 
        dest: '\\IP\logsTest\{{ ansible_hostname }}_{{ timestamp.stdout_lines[0] }}_testFileServer.txt'
delegate_to: localhost
      

```
