我有三个文件夹。我需要 Ansible 来检查它们并删除超过两天的。
这些是我的任务:
- name: Get older files path
find:
paths: "{{ path }}/DB/{{ item }}/"
age: 2d
file_type: directory
recurse: yes
register: filesolderthan2
with_items:
- "{{ bucket }}"
- name: Remove older files
file:
path: item.path
state: absent
with_items: "{{ filesolderthan2.results }}"
可变文件
bucket:
- test1
- test2
- test3
path: "/backup"
我确实得到了路径,但无法删除所有这些文件夹。
当我尝试使用
path: {{ item.path }}
听写错误