Add examples for `stdout` loops

These 2 methods are mentioned [here](https://docs.ansible.com/playbooks_conditionals.html), so I thought it'd make sense to have them in the repo too.
pull/63/head
Lorenzo Manacorda 9 years ago
parent 78839857ee
commit 97a4a31e38
  1. 10
      language_features/register_logic.yml

@ -29,5 +29,15 @@
- shell: echo "motd contains the word hi"
when: motd_result.stdout.find('hi') != -1
# you can use 'stdout_lines' to loop over the registered output lines
- name: motd lines mathing 'hi'
shell: echo "{{ item }}"
with_items: motd_result.stdout_lines
# you can also split 'stdout' yourself
- name: motd lines mathing 'hi'
shell: echo "{{ item }}"
with_items: motd_result.stdout.split('\n')