よく使うので備忘録に ansibleで実行したコマンドの出力結果(result.stdout)に、特定の文字(check_word)が含まれているかチェックする --- - hosts: localhost tasks: - name: run "echo helloworld" command: echo helloworld register: result - name: check pattern1 assert: that: check_word in result.stdout vars: check_word: "helloworld" - name: check pattern2 assert: that: result.stdout.find(check_word) != -1 vars: check_word: "helloworld"