For anyone looking for a solution.
Given this code
- shell: ls -alh'{{ item }}'
register:cmd_output
with_items:
- '/home/1'
- '/home/2'
I can retrieve the stdout of a specific command without looping through
cmd_output, like so:
- debug:
msg: '{{ cmd_output.results | selectattr("cmd", "equalto", "ls -alh
/home/1" ) | map(attribute="stdout") | join("") }}'
Some caveats ... equalto wasn't a valid test in the CentOS 7.2 Python 2.7.5
package. I ended up compiling Python 2.7.10, then using pip to install
ansible, which was an original design requirement which I just got back to
fulfilling.
--
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/5a2d1a42-510c-47a1-9855-b1773ea54abd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.