我必须在playook中编写与该curl相同的语法- curl-是“ {{url}}” -H“ Cookie:ROUTEID = 8d1617097a0a51a9e361709ad3f5254b; isBannerTester = 1” | grep -iE'Set-Cookie:|位置'
我必须在playook中编写与该curl相同的语法- curl-是“ {{url}}” -H“ Cookie:ROUTEID = 8d1617097a0a51a9e361709ad3f5254b; isBannerTester = 1” | grep -iE'Set-Cookie:|位置'
- 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"'
答案 0 :(得分:0)
尝试建议foo: '"bad" "wolf"'
。我认为应该避免引用。
shell: 'curl -Is \"https://{{ENV_DOMAIN}}/applicationNavigator/\"
-H \"Cookie: ROUTEID=8d1617097a0a51a9e361709ad3f5254b; isBannerTester=1\"|
grep -iE'
答案 1 :(得分:0)
尝试使用uri模块。
- name: curlcommand
uri:
url: https://studentconnect.acu.edu.au/BannerAdmin.ws/
headers:
Cookie: ROUTEID=8d1617097a0a51a9e361709ad3f5254b
isBannerTester=1
您甚至可以通过提供状态代码:200 或所需的任何代码来检查特定的状态代码。