Answers:
从文档:
请记住,查找插件在“控制”计算机上运行:
with_fileglob
是一个查找插件,因此它将在本地服务器(您正在从中运行ansible-playbook的服务器)上查找文件。
您可以执行以下操作:
- name: list files
action: command ls -1 /to/*
register: dumpfiles
- name: change ownership
action: file path=$item owner=newuser group=newgroup
with_items: ${dumpfiles.stdout_lines}