是否有 with_fileglob 可以在 ansible 中远程工作? [英] Is there with_fileglob that works remotely in ansible?
本文介绍了是否有 with_fileglob 可以在 ansible 中远程工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有 with_fileglob
在 ansible 中远程工作?
Is there with_fileglob
that works remotely in ansible?
主要是我确实想使用与 with_fileglob
类似的东西,但这会将文件放在远程/目标机器上,而不是在运行 ansible 的机器上.
Mainly I do want to use something similar with the with_fileglob
but that will glob the files on the remote/target machine, not on the one that is running ansible.
推荐答案
使用 find
模块 过滤文件,然后处理结果列表:
Use find
module to filter the files and then process the resulting list:
- name: Get files on remote machine
find:
paths: /path/on/remote
register: my_find
- debug:
var: item.path
with_items: "{{ my_find.files }}"
这篇关于是否有 with_fileglob 可以在 ansible 中远程工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文