如何在 ansible 查找模块中使用模式、年龄age_stamp选项



我想在/var/tmp 中查找具有特定模式"*_info"且上次修改时间大于 200 秒的文件。

这是我的剧本

---
- name: find module
hosts: myservers
gather_facts: no
tasks:
- name: find files in /var/tmp having specific pattetern _info with last modified time greater than 200 seconds
find:
paths: /var/tmp
patterens: '*_info'
age: 200
age_stamp: mtime
recurse: yes
file_type: file
register: out
- name: to print the files
debug:
var: out.files

低于错误。

PLAY [find module] *******************************************************************************************************
TASK [find files in /var/tmp having specific pattetern _info with last modified time greater than 200 seconds] ***********
fatal: [ansc1]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (find) module: patterens Supported parameters include: age, age_stamp, contains, depth, excludes, file_type, follow, get_checksum, hidden, paths, patterns, recurse, size, use_regex"}
PLAY RECAP ***************************************************************************************************************
ansc1                      : ok=0    changed=0    unreachable=0    failed=1

find 模块参数为patterns。您有一个键入为patterens.

最新更新