Hello, I am running a find and then working on each item, like:
-
name: “Finding …”
find: paths=“/app” pattern=“{{ pattern }}” recurse=yes get_checksum=yes
changed_when: False
register: find_results -
name: “Display files which were matched …”
debug: var=item.path
with_items: find_results.files
When I run this, I see a dump of the item var TWICE, as well as the item.path I am searching for. See below (masked out our files names). I am not debugging that if I was I would just say debug: var=item.
I just want to see a nice list of all the files found but the output for the debug: var is also jumping the whole “item” data structure.
Next, I want to take all the item.paths found and POPULATE a new list of just the files.
Any suggestions for A) why is debug var=item.path printing out all of item as well, and B) how can I just get a list of files.
ok: [hostA] => (item={u’uid’: 7052, u’woth’: False, u’mtime’: 1243008168.0, u’inode’: 786726, u’isgid’: False, u’size’: 84, u’roth’: False, u’isuid’: False, u’isreg’: True, u’gid’: 7052, u’ischr’: False, u’wusr’: True, u’xoth’: False, u’rusr’: True, u’nlink’: 1, u’issock’: False, u’rgrp’: True, u’path’: u’<file_path>‘, u’xusr’: False, u’atime’: 1471056911.3219833, u’isdir’: False, u’ctime’: 1393634477.6260712, u’isblk’: False, u’xgrp’: False, u’dev’: 64768, u’wgrp’: False, u’isfifo’: False, u’mode’: u’0640’, u’checksum’: u’ceed0ec81c110f5107306d3d56de879d255c8bef’, u’islnk’: False}) => {
“item”: {
“atime”: 1471056911.3219833,
“checksum”: “ceed0ec81c110f5107306d3d56de879d255c8bef”,
“ctime”: 1393634477.6260712,
“dev”: 64768,
“gid”: 7052,
“inode”: 786726,
“isblk”: false,
“ischr”: false,
“isdir”: false,
“isfifo”: false,
“isgid”: false,
“islnk”: false,
“isreg”: true,
“issock”: false,
“isuid”: false,
“mode”: “0640”,
“mtime”: 1243008168.0,
“nlink”: 1,
“path”: “<file_path>”,
“rgrp”: true,
“roth”: false,
“rusr”: true,
“size”: 84,
“uid”: 7052,
“wgrp”: false,
“woth”: false,
“wusr”: true,
“xgrp”: false,
“xoth”: false,
“xusr”: false
},
“item.path”: “<file_path>”
}