问题:
如何使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'"
答案 0 :(得分:4)
尝试
- 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告诉你是否有问题(如果你想要的话,用-C标志运行它来模拟干运行)。还可以尝试用repo URL周围的双引号替换single。