【发布时间】:2016-07-12 04:33:11
【问题描述】:
在 Ansible 保险库中存储随机生成的密码时,我没有任何问题,除非密码包含 /(斜杠,正斜杠)
根据Yaml Spec 1.2,在查看可打印的 ascii 字符时,我应该用反斜杠转义双引号、反斜杠和正斜杠。
我已经尝试过了,但是我得到了一个解析错误。
保险库文件中的行
test: "a<>?x\/x.,:;'-=_+b*()c&d{}\"e^f[]!@g%h\\i$j"
错误:
fatal: [127.0.0.1]: FAILED! => {"failed": true, "msg": "Syntax Error while loading YAML.\n\n\nThe error appears to have been in 'False': line 14, column 13, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\n(could not open file to display line)"}
【问题讨论】:
-
如果不转义正斜杠会出现什么错误?喜欢
test: "a<>?x/x.,:;'-=_+b*()c&d{}\"e^f[]!@g%h\\i$j" -
刚刚试过,你是对的,不需要转义
标签: yaml ansible ansible-vault