Skip to content

Instantly share code, notes, and snippets.

@serut
Created April 15, 2020 13:06
Show Gist options
  • Save serut/8e3c1c6fa56888c0ba935caac92498b1 to your computer and use it in GitHub Desktop.
Save serut/8e3c1c6fa56888c0ba935caac92498b1 to your computer and use it in GitHub Desktop.
Reproductible issue ansible command and double pipe
- name: Create docker network if not existing
command: "cat /path/to/something/not/existing || ls -al /etc"
# command: "docker network inspect {{ role_regards_init_docker_network_name }} >/dev/null 2>&1 || docker network create --driver overlay --subnet={{ role_regards_init_docker_network_subnet }} --gateway={{ role_regards_init_docker_network_gateway }} {{ role_regards_init_docker_network_name }}"
# command: "docker network inspect regards_network_leo_2 >/dev/null 2>&1 || docker network create --driver overlay --subnet=10.11.4.0/24 --gateway=10.11.4.1 regards_network_leo_2"
Output :
$ ansible-playbook -i inventories/cs-integration regards.yml
PLAY [Install REGARDS] **********************************************************************************************************************
TASK [Gathering Facts] **********************************************************************************************************************
ok: [swarm-host]
TASK [regards-init : Create docker network if not existing] *********************************************************************************
fatal: [swarm-host]: FAILED! => {"changed": true, "cmd": ["cat", "/path/to/something/not/existing", "||", "ls", "-al", "/etc"], "delta": "0:00:00.007741", "end": "2020-04-15 13:04:36.350227", "msg": "non-zero return code", "rc": 1, "start": "2020-04-15 13:04:36.342486", "stderr": "cat : option invalide -- 'a'\nSaisissez « cat --help » pour plus d'informations.", "stderr_lines": ["cat : option invalide -- 'a'", "Saisissez « cat --help » pour plus d'informations."], "stdout": "", "stdout_lines": []}
PLAY RECAP **********************************************************************************************************************************
swarm-host : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment