unixansiblepipeaixansible-lint

Exit code status in AIX with pipe for ansible


[306] Shells that use pipes should set the pipefail option       
    roles/Auto_Config_Agent/tasks/AUTO_configure_AIX.yml:10
    Task/Handler: Define customer name

Does anyone know how to do this on AIX?

For linux just use /bin/bash set -o pipefail

/bin/ksh tb can you use the command set -o pipefail?

Example play:

# Define customer name
  - name: "Define customer name"
    shell: cat {{ DIRCUSTOMER }} | grep {{ DATACUSTOMER }}- | awk -F'|' '{print $2}' | cut -f1 -d'.'
    register: customername

  - debug: var=customername.stdout

Solution

  • With v5+ you can add a comment # noqa risky-shell-pipe to silence the linting violation if you know you don't need it.

    Note: 306 was renamed to risky-shell-pipe in v5, like all the other numeric violations.