pipefail
option ANS-E3006Without the pipefail option set, a shell command that implements a pipeline can fail and still return 0.
If any part of the pipeline other than the terminal command fails, the whole pipeline will still return 0, which may be considered a success by Ansible. Pipefail is available in the bash shell.
- name: Example task
shell: ls -ld /tmp | tr -d tmp
args:
executable: /usr/bin/bash
It is recommended to use pipefail
with shell
commands that use pipes.
- name: Example task
shell: set -o pipefail && ls -ld /tmp | tr -d tmp
args:
executable: /usr/bin/bash