I was trying to download Istio using ansible. There I used the following structure.
- name: Download Istio
command: curl https://istio.io/downloadIstio | sh -
- name: Start minikube
command: minikube start
But when I run the command it returns,
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["curl", "https://istio.io/downloadIstio", "|", "sh", "-"], "delta": "0:00:00.005276", "end": "2019-11-20 11:32:17.749051", "msg": "non-zero return code", "rc": 2, "start": "2019-11-20 11:32:17.743775", "stderr": "curl: option -: is unknown\ncurl: try 'curl --help' or 'curl --manual' for more information", "stderr_lines": ["curl: option -: is unknown", "curl: try 'curl --help' or 'curl --manual' for more information"], "stdout": "", "stdout_lines": []}
How to solve this issue?
From the documentation of the "command" module:
The command(s) will not be processed through the shell, so variables like $HOME and operations like "<", ">", "|", ";" and "&" will not work. Use the shell module if you need these features.
Instead, use the "shell" module:
- name: Download Istio
shell: curl https://istio.io/downloadIstio | sh -