gpt4 book ai didi

yaml - 如何让 Ansible YAML 解析接受这个命令?

转载 作者:行者123 更新时间:2023-12-01 12:36:37 25 4
gpt4 key购买 nike

问题:
如何让 Ansible YAML 解析接受这个命令?

详情如下:

这个 YAML:

-shell: "/home/developer/eclipse/eclipse -application org.eclipse.equinox.p2.director -noSplash -repository
'http://moreunit.sourceforge.net/update-site' -installIUs
org.moreunit.feature.group"

由以下人员验证:
http://yaml-online-parser.appspot.com/
http://www.yamllint.com/
http://codebeautify.org/yaml-validator

但是 ansible 说:

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'

or equivalently:

when: "'ok' in result.stdout"

作为引用,此 YAML 完美运行:

-shell: "wget 'http://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gzip'"

最佳答案

尝试

 - shell: >
/home/developer/eclipse/eclipse
-application org.eclipse.equinox.p2.director
-noSplash
-repository 'http://moreunit.sourceforge.net/update-site'
-installIUs org.moreunit.feature.group

不要相信编辑器或语法高亮器。让 ansible 告诉你是否有问题(如果你想的话,用 -cflags运行它来模拟空运行)。还可以尝试将 repo URL 周围的单引号替换为双引号。

关于yaml - 如何让 Ansible YAML 解析接受这个命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29059605/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com