Ansible playbook 抱怨引号

批处理Regev

我正在使用带有 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 模块没有文件参数,shell 和 name 应该在同一列上,这就是为什么你得到错误的原因,并且还对 URL 使用双引号而不是完整的 shell 命令:

   - 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"

您可以使用get_url模块将文件下载到目的地并设置权限。我强烈建议使用 Ansible 角色,由贡献者在ansible 星系上呈现,而不是重新邀请轮子!

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章