title: How to pipe commands using Ansible? e.g. curl -sL host.com | sudo bash -
body: <p>I want to make the command via Ansible:</p>
  
  <pre><code>curl -sL https://deb.nodesource.com/setup | sudo bash -
  </code></pre>
  
  <p>How can I do it via Ansible? Now I have:</p>
  
  <pre><code>- name: Add repository
    command: curl -sL https://deb.nodesource.com/setup | sudo bash -
  </code></pre>
  
  <p>But it throw error:</p>
  
  <pre><code>[WARNING]: Consider using get_url or uri module rather than running curl
  </code></pre>
  
  <p><code>fatal: [127.0.0.1]: FAILED! =&gt; {"changed": true, "cmd": ["curl", "-sL", "https://deb.nodesource.com/setup", "|", "sudo", "bash", "-"], "delta": "0:00:00.006202", "end": "2017-12-27 15:11:55.441754", "msg": "non-zero return code", "rc": 2, "start": "2017-12-27 15:11:55.435552", "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": []}</code></p>