Registered variableで実行コマンドの内容を出力。ls_resultに実行結果の内容を登録して最後にターミナルに表示している
- name: Run CakePHP container
register: ls_result
- debug: var=ls_result.stdout_lines
when: ls_result | success
- debug: var=ls_result.stderr_lines
when: ls_result | failedansibleで最後に以下のエラーが出た
The error was: template error while templating string: no filter named 'success'when:の記述方法が2.9で変更になったためと思われる。以下の書き方で直した
- debug: var=ls_result.stdout_lines
when: ls_result is success
- debug: var=ls_result.stderr_lines
when: ls_result is failed[Ansible] Registered variable について調べてみた https://qiita.com/szk3/items/29e827f90a543c764a5e
Why it does not work for me? #1 swapnil-linux/ansible#1