【发布时间】:2020-04-08 05:51:31
【问题描述】:
我正在使用带有 Ansible 2.2.1.0 的 Ubuntu 16。
我正在尝试使用以下剧本安装docker-compose:
- name: Install Docker Compose.
shell: "curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose"
file:
dest=/usr/local/bin/docker-compose mode=x
src=/usr/local/bin/docker-compose dest=/usr/bin/docker-compose state=link
我收到此错误:
- name: Install Docker Compose.
shell: "curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose"
^ here
This one looks easy to fix. It seems that there is a value started
with a quote, and the YAML parser is expecting to see the line ended
with the same kind of quote. For instance:
when: "ok" in result.stdout
Could be written as:
when: '"ok" in result.stdout'
有什么问题?我有开头和结尾的引号。
【问题讨论】:
-
Shell 是一个内置的 ansible 模块。所有模块在语法上都必须在名称下方准确对齐。这与 ansible、YAML 无关。它们是“报价”而不是配额!
标签: ansible yaml ansible-2.x