Hello all,
I’ve the follow case, have some directories that receive though list, by example:
Directories:
- /path/to/dir1
- /path/to/dir2
- /path/to/dir3
My objective is use find module to get the files with .sh extension of these directories and set +x permissions, when I register the find command, receive a output like this:
`
“results”: [
{
“ansible_loop_var”: “item”,
“changed”: false,
“examined”: 2,
“failed”: false,
“files”: [
{
…
“path”: “/path/to/dir1/ficheros20.txt”,
…
},
{
…
“path”: “/path/to/dir1/ficheros20.txt”,
…
}
],
“invocation”: {
“module_args”: {
“age”: null,
“age_stamp”: “mtime”,
“contains”: null,
“depth”: null,
“excludes”: null,
“file_type”: “file”,
“follow”: false,
“get_checksum”: false,
“hidden”: false,
“path”: “/path/to/dir1/”,
“paths”: [
“/path/to/dir1/”
],
“patterns”: [
“*”
],
“recurse”: false,
“size”: null,
“use_regex”: false
}
},
“item”: “/path/to/dir1/”,
“matched”: 2,
“msg”: “”
},
{
“ansible_loop_var”: “item”,
“changed”: false,
“examined”: 2,
“failed”: false,
“files”: [
{
…
“path”: “/path/to/dir2/ficheros20.txt”,
…
},
{
…
“path”: “/path/to/dir2/ficheros20.txt”,
…
}
],
“invocation”: {
“module_args”: {
“age”: null,
“age_stamp”: “mtime”,
“contains”: null,
“depth”: null,
“excludes”: null,
“file_type”: “file”,
“follow”: false,
“get_checksum”: false,
“hidden”: false,
“path”: “/path/to/dir2/”,
“paths”: [
“/path/to/dir2/”
],
“patterns”: [
“*”
],
“recurse”: false,
“size”: null,
“use_regex”: false
}
},
“item”: “/path/to/dir2/”,
“matched”: 2,
“msg”: “”
}
]
`
As see, the files is a tupple then for join to the first index I can use this variable:
item.files.0.path
But is possible that in order to the size of directory be more big, how can I join to all index using with_items?
Thank you very much.
Best regards