I have a series of commands registered to the same var
- shell: ls -alh'{{ item }}'
register:cmd_output
with_items:
- '/home/1'
- '/home/2'
For some plays, I only need to evaluate a specific stdout. Assuming I want
to the results of 'ls -alh /home/2', my current method is to loop through
cmd_output and return stdout when the cmd matches my criteria:
- debug:
msg: '{{ item.stdout }}'
when: ( '{{ item.cmd }}' == 'ls -alh /home/1' )
with_items: '{{ cmd_output.results }}'
Is there a way to do this instead of looping through cmd_output.results?
--
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/554ae660-9712-439d-b7b2-438b04eb0844%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.