Hi ZillaYT, Its sometimes difficult to figure out how to get to specific values that are returned. Some times you have to "deconstruct" it.
If you take the output you get when you run your playbook and paste it into something like https://jsoneditoronline.org/ you can start to understand the structure and that will make it much easier to pick out the information you need. Normally I register my output register: facts_output and then I start drilling down. Looking at the data structure in something that helps you visualize it helps me. So this is a list of dictionaries and - debug: var=facts_output - debug: var=facts_output.ansible_facts.ansible_net_version Here is a longer version but if you figure out your data structure you don't have to do this "trial and error" method. # save the command output in a variable called "output" register: output # print the contents of the variable "output" which is a dictionary of lists of dictionaries - debug: var=output # print the first command that was run - debug: var=output.results[0].item # print the command results with line feeds - debug: var=output.results[0].stdout_lines # print the list item #72 - debug: var=output.results[0].stdout_lines[0][72] See this email exchange <https://groups.google.com/forum/#!topic/ansible-project/Ul5D-gAzRrg> on a similar topic. So you are going to want to see (assuming you save (register) your output into avariable called "output": - debug: var=output.acl_query.results['2'].item[0].path - debug: var=output.acl_query.results['2'].item[1].entity - debug: var=output.acl_query.results['2'].item[1].etype - debug: var=output.acl_query.results['2'].item[1].permissions ..you get the idea <https://lh3.googleusercontent.com/-dQTvHSNp5-w/WnkBVO-H3yI/AAAAAAAAF18/-AtgGlEy9LAJ7Qna4-TGoycSJqtUe6MbgCLcBGAs/s1600/2018-02-05_17-06-19.png> On Monday, February 5, 2018 at 8:10:48 AM UTC-8, ZillaYT wrote: > > I have a register with the following output of a query from the acl module. > > ok: [server.domain.com] => { > "acl_query.results": [ > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "changed": false, > "item": [ > { > "path": "/local/py/virtualenvs/service_mix/logs" > }, > { > "etype": "other", > "permissions": "rwx" > } > ], > "skip_reason": "Conditional result was False", > "skipped": true > }, > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "changed": false, > "item": [ > { > "path": "/local/py/virtualenvs/service_mix/tmp_files" > }, > { > "etype": "other", > "permissions": "rwx" > } > ], > "skip_reason": "Conditional result was False", > "skipped": true > }, > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "_ansible_parsed": true, > "acl": [ > "user::rwx", > "user:cva:rwx", > "user:scmauto:rwx", > "group::r-x", > "mask::rwx", > "other::r-x", > "default:user::rwx", > "default:user:cva:rwx", > "default:user:scmauto:rwx", > "default:group::r-x", > "default:mask::rwx", > "default:other::r-x" > ], > "changed": false, > "failed": false, > "invocation": { > "module_args": { > "default": false, > "entity": "", > "entry": null, > "etype": null, > "follow": true, > "path": "/local/httpd", > "permissions": null, > "recursive": false, > "state": "query", > "use_nfsv4_acls": false > } > }, > "item": [ > { > "path": "/local/httpd" > }, > { > "entity": "my_user", > "etype": "user", > "permissions": "rwx" > } > ], > "msg": "current acl" > } > ] > } > > > How can I write a debug module that will show me, for each item in results > array, the path, entity, etype, and permissions values? > > - debug: msg="{{ acl_query.results.??? }}" > > (Why am I so bad at this? LOL) > On Monday, February 5, 2018 at 8:10:48 AM UTC-8, ZillaYT wrote: > > I have a register with the following output of a query from the acl module. > > ok: [server.domain.com] => { > "acl_query.results": [ > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "changed": false, > "item": [ > { > "path": "/local/py/virtualenvs/service_mix/logs" > }, > { > "etype": "other", > "permissions": "rwx" > } > ], > "skip_reason": "Conditional result was False", > "skipped": true > }, > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "changed": false, > "item": [ > { > "path": "/local/py/virtualenvs/service_mix/tmp_files" > }, > { > "etype": "other", > "permissions": "rwx" > } > ], > "skip_reason": "Conditional result was False", > "skipped": true > }, > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "_ansible_parsed": true, > "acl": [ > "user::rwx", > "user:cva:rwx", > "user:scmauto:rwx", > "group::r-x", > "mask::rwx", > "other::r-x", > "default:user::rwx", > "default:user:cva:rwx", > "default:user:scmauto:rwx", > "default:group::r-x", > "default:mask::rwx", > "default:other::r-x" > ], > "changed": false, > "failed": false, > "invocation": { > "module_args": { > "default": false, > "entity": "", > "entry": null, > "etype": null, > "follow": true, > "path": "/local/httpd", > "permissions": null, > "recursive": false, > "state": "query", > "use_nfsv4_acls": false > } > }, > "item": [ > { > "path": "/local/httpd" > }, > { > "entity": "my_user", > "etype": "user", > "permissions": "rwx" > } > ], > "msg": "current acl" > } > ] > } > > > How can I write a debug module that will show me, for each item in results > array, the path, entity, etype, and permissions values? > > - debug: msg="{{ acl_query.results.??? }}" > > (Why am I so bad at this? LOL) > On Monday, February 5, 2018 at 8:10:48 AM UTC-8, ZillaYT wrote: > > I have a register with the following output of a query from the acl module. > > ok: [server.domain.com] => { > "acl_query.results": [ > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "changed": false, > "item": [ > { > "path": "/local/py/virtualenvs/service_mix/logs" > }, > { > "etype": "other", > "permissions": "rwx" > } > ], > "skip_reason": "Conditional result was False", > "skipped": true > }, > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "changed": false, > "item": [ > { > "path": "/local/py/virtualenvs/service_mix/tmp_files" > }, > { > "etype": "other", > "permissions": "rwx" > } > ], > "skip_reason": "Conditional result was False", > "skipped": true > }, > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "_ansible_parsed": true, > "acl": [ > "user::rwx", > "user:cva:rwx", > "user:scmauto:rwx", > "group::r-x", > "mask::rwx", > "other::r-x", > "default:user::rwx", > "default:user:cva:rwx", > "default:user:scmauto:rwx", > "default:group::r-x", > "default:mask::rwx", > "default:other::r-x" > ], > "changed": false, > "failed": false, > "invocation": { > "module_args": { > "default": false, > "entity": "", > "entry": null, > "etype": null, > "follow": true, > "path": "/local/httpd", > "permissions": null, > "recursive": false, > "state": "query", > "use_nfsv4_acls": false > } > }, > "item": [ > { > "path": "/local/httpd" > }, > { > "entity": "my_user", > "etype": "user", > "permissions": "rwx" > } > ], > "msg": "current acl" > } > ] > } > > > How can I write a debug module that will show me, for each item in results > array, the path, entity, etype, and permissions values? > > - debug: msg="{{ acl_query.results.??? }}" > > (Why am I so bad at this? LOL) > On Monday, February 5, 2018 at 8:10:48 AM UTC-8, ZillaYT wrote: > > I have a register with the following output of a query from the acl module. > > ok: [server.domain.com] => { > "acl_query.results": [ > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "changed": false, > "item": [ > { > "path": "/local/py/virtualenvs/service_mix/logs" > }, > { > "etype": "other", > "permissions": "rwx" > } > ], > "skip_reason": "Conditional result was False", > "skipped": true > }, > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "changed": false, > "item": [ > { > "path": "/local/py/virtualenvs/service_mix/tmp_files" > }, > { > "etype": "other", > "permissions": "rwx" > } > ], > "skip_reason": "Conditional result was False", > "skipped": true > }, > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "_ansible_parsed": true, > "acl": [ > "user::rwx", > "user:cva:rwx", > "user:scmauto:rwx", > "group::r-x", > "mask::rwx", > "other::r-x", > "default:user::rwx", > "default:user:cva:rwx", > "default:user:scmauto:rwx", > "default:group::r-x", > "default:mask::rwx", > "default:other::r-x" > ], > "changed": false, > "failed": false, > "invocation": { > "module_args": { > "default": false, > "entity": "", > "entry": null, > "etype": null, > "follow": true, > "path": "/local/httpd", > "permissions": null, > "recursive": false, > "state": "query", > "use_nfsv4_acls": false > } > }, > "item": [ > { > "path": "/local/httpd" > }, > { > "entity": "my_user", > "etype": "user", > "permissions": "rwx" > } > ], > "msg": "current acl" > } > ] > } > > > How can I write a debug module that will show me, for each item in results > array, the path, entity, etype, and permissions values? > > - debug: msg="{{ acl_query.results.??? }}" > > (Why am I so bad at this? LOL) > On Monday, February 5, 2018 at 8:10:48 AM UTC-8, ZillaYT wrote: > > I have a register with the following output of a query from the acl module. > > ok: [server.domain.com] => { > "acl_query.results": [ > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "changed": false, > "item": [ > { > "path": "/local/py/virtualenvs/service_mix/logs" > }, > { > "etype": "other", > "permissions": "rwx" > } > ], > "skip_reason": "Conditional result was False", > "skipped": true > }, > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "changed": false, > "item": [ > { > "path": "/local/py/virtualenvs/service_mix/tmp_files" > }, > { > "etype": "other", > "permissions": "rwx" > } > ], > "skip_reason": "Conditional result was False", > "skipped": true > }, > { > "_ansible_item_result": true, > "_ansible_no_log": false, > "_ansible_parsed": true, > "acl": [ > "user::rwx", > "user:cva:rwx", > "user:scmauto:rwx", > "group::r-x", > "mask::rwx", > "other::r-x", > "default:user::rwx", > "default:user:cva:rwx", > "default:user:scmauto:rwx", > "default:group::r-x", > "default:mask::rwx", > "default:other::r-x" > ], > "changed": false, > "failed": false, > "invocation": { > "module_args": { > "default": false, > "entity": "", > "entry": null, > "etype": null, > "follow": true, > "path": "/local/httpd", > "permissions": null, > "recursive": false, > "state": "query", > "use_nfsv4_acls": false > } > }, > "item": [ > { > "path": "/local/httpd" > }, > { > "entity": "my_user", > "etype": "user", > "permissions": "rwx" > } > ], > "msg": "current acl" > } > ] > } > > > How can I write a debug module that will show me, for each item in results > array, the path, entity, etype, and permissions values? > > - debug: msg="{{ acl_query.results.??? }}" > > (Why am I so bad at this? LOL) > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/191ba17d-6671-4fe3-86ea-5b665789fe56%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
