- name: Copy a single file where the source is on the remote host
win_copy:
src: C:\Temp\foo.txt
dest: C:\ansible\foo.txt
*remote_src: yes <-------------------------use this
*- name: Copy a folder recursively where the source is on the remote host
win_copy:
src: C:\Temp
dest: C:\ansible
* remote_src: yes <-----------------------use this*
*With regards*
*Raju Das*
On Wed, Sep 16, 2020 at 9:00 PM rubod singh <[email protected]> wrote:
> actually
>
> source file is also on windows server ( which is also the target server)
>
> do we need to mention any remote_host ?
>
>
> On Wed, Sep 16, 2020 at 11:28 AM rubod singh <[email protected]>
> wrote:
> >
> > Thanks Rahul -
> >
> > got this error now
> >
> >
> > {
> > "src": "C:\\abc.txt",
> > "dest": "C:\\ansible\\abc.txt",
> > "msg": "Could not find or access 'C:\\abc.txt'\nSearched
> >
> in:\n\t/tmp/awx_81_g9rtokz0/project/projects/AWX_POC/files/C:\\abc.txt\n\t/tmp/awx_81_g9rtokz0/project/projects/AWX_POC/C:\\abc.txt\n\t/tmp/awx_81_g9rtokz0/project/projects/AWX_POC/files/C:\\abc.txt\n\t/tmp/awx_81_g9rtokz0/project/projects/AWX_POC/C:\\abc.txt
> > on the Ansible Controller.\nIf you are using a module and expect the
> > file to exist on the remote, see the remote_src option",
> > "exception": "Traceback (most recent call last):\n File
> > \"/usr/lib/python3.6/site-packages/ansible/plugins/action/win_copy.py\",
> > line 402, in run\n source = self._find_needle('files', source)\n
> > File
> \"/usr/lib/python3.6/site-packages/ansible/plugins/action/__init__.py\",
> > line 1192, in _find_needle\n return
> > self._loader.path_dwim_relative_stack(path_stack, dirname, needle)\n
> > File \"/usr/lib/python3.6/site-packages/ansible/parsing/dataloader.py\",
> > line 327, in path_dwim_relative_stack\n raise
> > AnsibleFileNotFound(file_name=source, paths=[to_native(p) for p in
> > search])\nansible.errors.AnsibleFileNotFound: Could not find or access
> > 'C:\\abc.txt'\nSearched
> >
> in:\n\t/tmp/awx_81_g9rtokz0/project/projects/AWX_POC/files/C:\\abc.txt\n\t/tmp/awx_81_g9rtokz0/project/projects/AWX_POC/C:\\abc.txt\n\t/tmp/awx_81_g9rtokz0/project/projects/AWX_POC/files/C:\\abc.txt\n\t/tmp/awx_81_g9rtokz0/project/projects/AWX_POC/C:\\abc.txt
> > on the Ansible Controller.\nIf you are using a module and expect the
> > file to exist on the remote, see the remote_src option\n",
> > "_ansible_no_log": false,
> > "changed": false
> > }
> >
> >
> >
> > On Wed, Sep 16, 2020 at 9:20 AM Rahul Puli <[email protected]>
> wrote:
> > >
> > > Hello Rubod,
> > >
> > > Please try to run the below code and check.
> > >
> > > ---
> > > - name: "Copy Files"
> > > hosts: all
> > >
> > > tasks:
> > > - name: Copy Files
> > > win_copy:
> > > src: C:\abc.txt
> > > dest: C:\ansible\abc.txt
> > >
> > > On Wednesday, September 16, 2020 at 6:17:13 PM UTC+5:30
> [email protected] wrote:
> > >>
> > >> HI Team,
> > >>
> > >> please help me in this as i'm very new to this , i'm getting this
> > >> error while testing the simple windows file copy module through awx.
> > >>
> > >> Ansible VM is on Azure
> > >> Target Windows machine is also on Azure - No network restrictions as
> > >> this is a POC project
> > >>
> > >> playbook :
> > >>
> > >> ---
> > >> - name: "Copy Files"
> > >> hosts: all
> > >>
> > >> tasks:
> > >> - name: Copy Files
> > >> win_copy:
> > >> remote_src: C:\abc.txt
> > >> remote_dest: C:\ansible\abc.txt
> > >>
> > >>
> > >>
> > >> error :
> > >>
> > >> {
> > >> "src": null,
> > >> "dest": null,
> > >> "msg": "src (or content) and dest are required",
> > >> "_ansible_no_log": false,
> > >> "changed": false
> > >> }
> > >>
> > >>
> > >> Any help is appreciated.
> > >>
> > >> Thanks
> > >>
> > >> Rubod
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups "Ansible Project" group.
> > > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> > > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f508c5c1-68b7-43f4-a7fd-7dd2712a6f94n%40googlegroups.com
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CADiG6us0%2Bo3%2BZ8KGrETSkBGHaWaE9gUbSBWiSt0%2BXsD5LxpRFg%40mail.gmail.com
> .
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAApSnDD8ALusw2H%2BV12Y_1ujkKPjyDtotjK8naCQFDRRifO90g%40mail.gmail.com.