我想检查其他组对/tmp/ap//jets//conf/下所有文件的读取权限。当我调试find_config时,我可以看到roth的值。但请让我知道如何单独打印这些值。
- name: List config
shell: ls -d /tmp/ap/*/jets/*/conf/
register: config
- name: Status
find:
paths: "{{item}}"
loop: "{{config.stdout_lines}}"
register: find_config
- debug:
msg: "{{item.files.roth}}"
loop: "{{find_config.results}}"
我还需要做一个检查,比如当roth是真的,然后打印FAIL。我需要下面这样的东西:
- debug:
msg: "FAIL"
when: item.files.roth
loop: "{{find_config.results}}"
find_config:的调试输出的一部分
"files": [
{
"atime": 1608008199.489219,
"ctime": 1608008199.4442186,
"dev": 624768,
"gid": 103,
"gr_name": "prt",
"isgid": false,
"islnk": false,
"isreg": true,
"issock": false,
"isuid": false,
"mode": "0640",
"mtime": 16008199.4442186,
"nlink": 1,
"path": "/tmp/ap/new1/jets/f2/conf/conf.xml",
"pw_name": "wl",
"rgrp": true,
"roth": false,
"rusr": true,
"size": 21835,
我将shell的输出传递给find中的路径,现在它正在工作。
- name: List config
shell: ls -d /tmp/ap/*/jets/*/conf/
register: config
- name: Status
find:
paths: "{{config.stdout_lines}}"
register: find_config
- debug:
msg: "{{item.roth}}"
loop: "{{find_config.files}}"