Hi Jerry, On 25.03.19 18:12, Jerry Seven wrote: > ok: [hostname] => { > "msg": [
^ the [ tells you this is an array. This happens because you call register on a task with a loop. For each item of the loop, a new dict gets added to this array. > { > "_ansible_ignore_errors": null, > "_ansible_item_result": true, > "_ansible_no_log": false, > "_ansible_parsed": true, > "changed": true, > "cmd": "rpm -q TaniumClient", > "delta": "0:00:00.024756", > "end": "2019-03-25 13:10:34.751439", > "failed": false, > "invocation": { > "module_args": { > "_raw_params": "rpm -q TaniumClient", > "_uses_shell": true, > "chdir": null, > "creates": null, > "executable": null, > "removes": null, > "stdin": null, > "warn": true > } > }, > "item": "TaniumClient", > "rc": 0, > "start": "2019-03-25 13:10:34.726683", > "stderr": "", > "stderr_lines": [], > "stdout": "TaniumClient-6.0.314.1442-1.rhe7.x86_64", > "stdout_lines": [ > "TaniumClient-6.0.314.1442-1.rhe7.x86_64" > ] > }, > > > but > > - debug: > msg: "{{ pkg.results.stdout }}" > > fails. Seems like I should be able to print that. You could print {{ pkg.results.0.stdout }} for the first element of the loop, or {{ pkg.results.1.stdout }} for the second element of the loop. > I just dont understand why it works: > > - debug: > msg: "{{ echo.results|map(attribute='stdout_lines')|list > }}" What this does is, take the array of dictionaries, and look in each dictionary for the key stdout_lines. Then take the value of that key and make a list out of it. HTH Sebastian -- Sebastian Meyer Linux Consultant & Trainer Mail: me...@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bf837057-c1bc-ce1f-0b8e-a2e24c94044b%40b1-systems.de. For more options, visit https://groups.google.com/d/optout.