From 83d39839cf14cb276319dfce2ddf70e2be1ca5d1 Mon Sep 17 00:00:00 2001 From: Lorenzo Manacorda Date: Wed, 17 Jun 2015 18:47:14 +0200 Subject: [PATCH] Add alternative example for string finding Another way in which the output of command can be matched against a string. --- language_features/register_logic.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/language_features/register_logic.yml b/language_features/register_logic.yml index dcfe8a8..e539991 100644 --- a/language_features/register_logic.yml +++ b/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 }}"