【发布时间】:2016-07-14 04:07:48
【问题描述】:
目前,我正在使用 shell 脚本从 FTP 服务器下载文件。 Ansible 将执行我的脚本并继续其他自动化作业。
请告诉我在 Ansible playbook 中使用“get_url”而不是“shell”的最佳方法。以下语法仅适用于下载单个文件,但我的要求是下载多个文件和目录。
感谢您的帮助。
- name: FTP Download
get_url: url=ftp://username:password@ftp.server.com/2016/03/value/myfile dest=/home/user/03/myfile1
register: get_url_result
【问题讨论】:
-
看来
get_url不支持递归下载。我认为wget是下载目录/我的要求的最佳选择。我正在使用- shell: wget -r -np -nH --cut-dirs=1 ftp://username:password@ftp.server.com/2016/03/*