Add alternative example for string finding

Another way in which the output of command can be matched against a string.
pull/63/head
Lorenzo Manacorda 9 years ago
parent b0232506c5
commit 83d39839cf
  1. 5
      language_features/register_logic.yml

@ -30,6 +30,11 @@
- shell: echo "motd contains the word hi"
when: motd_result.stdout.find('hi') != -1
# or also:
- shell: echo "motd contains word hi"
when: "'hi' in motd_result.stdout"
# you can use 'stdout_lines' to loop over the registered output lines
- name: motd lines matching 'hi'
shell: echo "{{ item }}"