Hi ,

  Thanks, following syntax worked for me.

 - name: use find to get the files list which you want to copy/fetch
      find:
        paths: /tmp/
        patterns: ".*exe"
        use_regex: True
      register: file_2_fetch

    - name: use fetch to get the files
      fetch:
        src: "{{ item.path }}"
        dest: /tmp/
        flat: yes
      with_items: "{{ file_2_fetch.files }}"

 *Thanks & Regards,*
*Rahul Kolan*



*DISCLAIMER: *
This message including attachments if any intended solely for specific
individual and purpose & may contain confidential material AND/OR Private
Company Information. If you are not the intended recipient, any disclosure,
copying or distribution of this message or any action based on it, is
strictly prohibited & protected under relevant law. If you have received
this communication in error, please contact the sender or delete this
message immediately. Thank you for your kind cooperation.


On Mon, Jul 1, 2019 at 8:11 PM [email protected] <[email protected]>
wrote:

> Based on v2.8, I don’t think you can wildcard filenames with fetch and it
> doesn’t seem to have owner, group or mode parameters (like copy) either. I
> think this discussion about a “wrapper” script or using the alternative
> synchronise module may help with your particular query though?:
>
>
>
>
> https://serverfault.com/questions/691080/how-to-fetch-multiple-files-from-remote-machine-to-local-with-ansible
>
>
>
>
>
> Also, this link with all module details:
>
>
>
> https://docs.ansible.com/ansible/latest/modules/list_of_all_modules.html
>
>
>
>
>
> Regards
>
> Phil
>
>
>
> *From:* [email protected] <[email protected]>
> *On Behalf Of *[email protected]
> *Sent:* 01 July 2019 14:24
> *To:* [email protected]
> *Subject:* Re: [ansible-project] copy files from remote to local
>
>
>
>
>
> On 01/07/19 6:49 PM, Rahul Kolan wrote:
>
> Team,
>
>
>
>    Can someone provide me solution to copy all source /tmp/*.exe files to
> local Ansible machine.
>
>
>
> I tried below solution but its not working.
>
> - name: example copying file with owner and permissions
>       fetch:
>         src: /tmp/*.exe
>         dest: /tmp/test/
>         flat: yes
>         owner: root
>         group: root
>         mode: 0777
>
>
>
> Please describe what do you mean by not working. Do you get any error
> message? Describe the expected and actual results.
>
> -
>
> Sudheer S
>
> --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/2b80c596-6d7d-925b-a9b7-dfe671ccb5e7%40techchorus.net
> <https://groups.google.com/d/msgid/ansible-project/2b80c596-6d7d-925b-a9b7-dfe671ccb5e7%40techchorus.net?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/ae54a7165367491d94e585b13ba3de3a%40bham.ac.uk
> <https://groups.google.com/d/msgid/ansible-project/ae54a7165367491d94e585b13ba3de3a%40bham.ac.uk?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAMonjRgrssH3arqpuYa9i-7ykHdOZVFs6QSP%2Bj8FNR0GMsb_ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to