Say I have the following ansible command that adds the docker repository to apt
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu xenial stable
state: present
I'd love the command to automatically determine the version since I might not always run this on xenial
. So I tried the following:
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable
state: present
But I get an error: E:Failed to fetch https://download.docker.com/linux/ubuntu/dists/$(lsb_release/-cs)/binary-amd64/Packages 404 Not Found
What's the right way to escape the$(..)
so that it evaluates correctly in bash before the command is executed?