sakhdeek
sakhdeek

Reputation: 25

Ansible fetch module issue with destination directory

When I am using the fetch module of ansible it always first create temp directories under the root folder with the structure of hostname/tmp/ and then copies the file

I have tried with several options but couldn't find a workaround to directly copy in a particular directory via bypassing the temp folders creationg

Is there any workaround to it

# Store file into /tmp/fetched/host.example.com/tmp/somefile
- fetch:
    src: /tmp/somefile
    dest: /tmp/fetched

# Specifying a path directly
- fetch:
    src: /tmp/somefile
    dest: /tmp/prefix-{{ inventory_hostname }}
    flat: yes

Upvotes: 2

Views: 1411

Answers (1)

Vladimir Botka
Vladimir Botka

Reputation: 68084

Try the synchronize module

- synchronize:
    mode: pull
    src: /tmp/somefile
    dest: /tmp/fetched

Upvotes: 2

Related Questions