i have simple ansible playbook, dependencies installed docker-compose , docker error when installing docker-compose, task on playbook install docker-compose in centos7 environment.
#ensure docker-compose , chmod +x /usr/local/bin/docker-compose - name: ensure docker-compose installed , available command: curl -l https://github.com/docker/compose/releases/download/1.7.0-rc1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose - name: ensure permissions docker-compose command: chmod +x /usr/local/bin/docker-compose
the following error appears:
task: [ensure docker-compose installed , available] ********************** failed: [nutrilife-aws] => {"changed": true, "cmd": ["curl", "-l", "https://github.com/docker/compose/releases/download/1.7.0-rc1/docker-compose-`uname", "-s`-`uname", "-m`", ">", "/usr/local/bin/docker-compose"], "delta": "0:00:00.004592", "end": "2016-03-26 14:19:41.852780", "rc": 2, "start": "2016-03-26 14:19:41.848188", "warnings": ["consider using get_url module rather running curl"]} stderr: curl: option -s`-`uname: unknown curl: try 'curl --help' or 'curl --manual' more information fatal: hosts have failed -- aborting play recap ******************************************************************** retry, use: --limit @/home/mmaia/playbook.retry nutrilife-aws : ok=4 changed=0 unreachable=0 failed=1
i kind of stuck simple error couple of hours. got command standard docker site , tested directly in shell , works. have tried using double quotes wrap around command command: "curl ..." didn't change error.
as hellov
pointed out need use shell
module if want utilise things shell expansion or shell's environment variables.
however, in ansible typically better off using higher level modules , resorting shell
or command
modules if can't need module. approach gives better control of execution free such easy idempotency , better output visibility.
in case can use get_url
(i believe ansible warn if attempt shell out curl might better off module) fetch things internet.
in case task might this:
- name: ensure docker-compose installed , available get_url: url : https://github.com/docker/compose/releases/download/1.7.0-rc1/docker-compose-{{ ansible_system }}-{{ ansible_userspace_architecture }} dest: /usr/local/bin/docker-compose mode: 'u+x,g+x'
the above task uses special variables returned gathering facts on targeted host task should run fine on either linux systems or os x (you'd need conditional suffix of .exe
windows link work , different destination path etc).
it uses mode
parameter file
module add execution permissions user , group can avoid chmod
task.
Comments
Post a Comment