【发布时间】:2019-06-11 04:49:34
【问题描述】:
我必须在 playook 中编写与此 curl 中给出的相同的语法 - curl -Is "{{url}}" -H "Cookie: ROUTEID=8d1617097a0a51a9e361709ad3f5254b; isBannerTester=1"|grep -iE 'Set-Cookie:|Location'
我必须在 playook 中编写与此 curl 中给出的相同的语法 - curl -Is "{{url}}" -H "Cookie: ROUTEID=8d1617097a0a51a9e361709ad3f5254b; isBannerTester=1"|grep -iE 'Set-Cookie:|Location'
- name: "sanity"
shell: curl -Is "https://{{ENV_DOMAIN}}/applicationNavigator/" -H "Cookie: ROUTEID=8d1617097a0a51a9e361709ad3f5254b; isBannerTester=1"|grep -iE
args:
warn: no
register: res
- debug:
var: res
错误!加载 YAML 时出现语法错误。 在此上下文中不允许映射值
错误似乎在“/mnt/banner/deploy/ansible/sanity_test_update.yml”中:第 40 行,第 84 列,但可能 根据确切的语法问题,位于文件的其他位置。
违规行似乎是:
- name: "sanity"
shell: curl -Is "https://studentconnect.acu.edu.au/BannerAdmin.ws/" -H "Cookie: ROUTEID=8d1617097a0a51a9e361709ad3f5254b; isBannerTester=1"|grep -iE
^ here
We could be wrong, but this one looks like it might be an issue with
unbalanced quotes. If starting a value with a quote, make sure the
line ends with the same set of quotes. For instance this arbitrary
example:
foo: "bad" "wolf"
Could be written as:
foo: '"bad" "wolf"'
【问题讨论】:
-
如果我从本地运行 cURL 命令 [curl -Is "studentconnect.acu.edu.au/BannerAdmin.ws" -H "Cookie: ROUTEID=8d1617097a0a51a9e361709ad3f5254b; isBannerTester=1"|grep -iE 'Set-Cookie:|Location']命令提示其给出结果如下- curl -Is "studentconnect.acu.edu.au/BannerAdmin.ws" -H "Cookie: ROUTEID=8d1617097a0a51a9e361709ad3f5254b; isBannerTester=1"|grep -iE 'Set-Cookie:|Location' 我在剧本中尝试使用 -command : curl -Is "studentconnect.acu.edu.au/BannerAdmin.ws" -H "Cookie:ROUTEID=8d1617097a0a51a9e361709ad3f5254b; isBannerTester=1 它的nt工作
-
低于错误-致命:[localhost]:失败! => {“更改”:真,“cmd”:[“curl”,“-Is”,“studentconnect.acu.edu.au/BannerAdmin.ws”,“-H”,“Cookie:ROUTEID=8d1617097a 0a51a9e361709ad3f5254b;isBannerTester=1”],“delta ": "0:00:21.349820", "end": "2019-06-11 19:49:15.116093", "msg": "非零返回码", "rc": 7, "start": " 2019-06-11 19:48:53.766273", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
-
似乎我的脚本现在正在运行,但有时它会出错,有时它会起作用,我怀疑它的超时问题。任何人都可以帮助获取超时语法,下面是我的脚本---任务:-名称:cURL 命令外壳:curl -Is "studentconnect.acu.edu.au/BannerAdmin.ws" -H "Cookie:ROUTEID=8d1617097a0a51a9e361709ad3f5254b; isBannerTester=1" args: warn :没有注册:res - 调试:var:res.stdout_lines