目标目录的Ansible fetch module问题

时间:2019-03-29 07:41:25

标签: ansible

当我使用ansible的获取模块时,它总是首先在根文件夹下使用hostname / tmp /结构创建临时目录,然后复制文件

我尝试了几种方法,但找不到通过绕过临时文件夹创建直接在特定目录中复制的解决方法

有没有解决方法

# 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

1 个答案:

答案 0 :(得分:0)

一种选择是尝试使用synchronize模块。

- synchronize:
    mode: pull
    src: /tmp/somefile
    dest: /tmp/fetched
相关问题