Groovy到AnsibleTower中的转义字符

8iwquhpp  于 2023-02-21  发布在  其他
关注(0)|答案(1)|浏览(108)

在密码从groovy脚本传输到ansible塔插件的过程中,是否有方法发送带有斜杠““的特殊字符的密码

ansibleTower(async: false, credential: 'test_cred', extraVars: """
---
password: "U*gLO8br1dMJ\y!U"
"""

在传递特殊字符时,它无法读取密码。是否有任何正则表达式可以发送此特殊字符

Unable to request job template invocation Extra vars are bad: ["Cannot parse as JSON (error: Expecting value: line 2 column 1 (char 1)) or YAML (error: while scanning a double-quoted scalar\n  in \"<unicode string>\", line 4, column 16:\n    sudo_password: \"U*gLO8br1dMJ\\y!U\"\n                   ^\nfound unknown escape character 'y'\n  in \"<unicode string>\", line 4, column 30:\n    sudo_password: \"U*gLO8br1dMJ\\y!U\"\n                                 ^)."]
wpx232ag

wpx232ag1#

在密码中添加一个额外的“\”就足以转义密码。例如“U*gLO8br1dMJ\y!U”就足够了

相关问题