假设我有以下ansible命令,将docker存储库添加到apt
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu xenial stable
state: present
我希望命令自动确定版本,因为我可能并不总是在xenial
上运行它.所以我尝试了以下内容:
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable
state: present
但我收到一个错误:E:Failed to fetch https://download.docker.com/linux/ubuntu/dists/$(lsb_release/-cs)/binary-amd64/Packages 404 Not Found
逃避$(..)
的正确方法是什么,以便在执行命令之前在bash中正确评估?