2017-12-27 27 views
0

:책임자 : curl -sL host.com | sudo를 강타 - 나는 Ansible를 통해 명령을 만들고 싶어

curl -sL https://deb.nodesource.com/setup | sudo bash - 

가 어떻게 그것을 Ansible를 통해 할 수 있습니까?

- name: Add repository 
    command: curl -sL https://deb.nodesource.com/setup | sudo bash - 

를하지만 오류가 발생 : 지금 나는이 당신이 할 수있는

[WARNING]: Consider using get_url or uri module rather than running curl 

fatal: [127.0.0.1]: FAILED! => {"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": []}

답변

3

:

- name: Add repository 
    shell: curl -sL https://deb.nodesource.com/setup | sudo bash - 
    args: 
    warn: no 

shell 파이프를 허용, warn: no 경고를 억제합니다.

하지만 내가 너라면 + apt_repositorycheck_mode을 지원하는 자체 설명 안내서를 만들 수있는 유용한 모듈을 사용합니다.