Can url path in get_url be build dynamically?

25 views
Skip to first unread message

Kenneth Wong

unread,
Aug 2, 2019, 10:16:54 AM8/2/19
to Ansible Project
The following playbook will failed but exchanged with commented out line then it would work.
Is there a way to evaluate the url string in get_url?
---
- hosts: all
  become: true
  tasks:
  - name: install docker-compose
    get_url: 
      dest: /usr/local/bin/docker-compose
      mode: '0744'
      owner: vagrant
      group: vagrant

======

TASK [install docker-compose] **************************************************
fatal: [default]: FAILED! => {"changed": false, "dest": "/usr/local/bin/docker-compose", "elapsed": 0, "msg": "Request failed", "response": "HTTP Error 400: Bad Request", "status_code": 400, "url": "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m`"}

Joacim Mårtensson

unread,
Aug 3, 2019, 6:24:07 AM8/3/19
to Ansible Project
Try using Ansible facts instead

     url: https://github.com/docker/compose/releases/download/1.24.1/docker-compose-{{ ansible_system }}-{{ ansible_architecture }}

Kenneth Wong

unread,
Aug 3, 2019, 2:32:31 PM8/3/19
to Ansible Project
That worked great. Thank you.
Reply all
Reply to author
Forward
0 new messages