我正在尝试将ssh
私钥存储为ansible
变量。
它位于加密文件中,或多或少像这样
my_private_key: |
-----BEGIN OPENSSH PRIVATE KEY-----
kd02ke0ke0k20ke0ke40430940943090494
[...]
Xekrfmfimimfimfeimiefmim4304309430943==
-----END OPENSSH PRIVATE KEY-----
Run Code Online (Sandbox Code Playgroud)
但是ansible
执行失败,如下:
ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: Expecting value: line 1 column 1 (char 0)
Syntax Error while loading YAML.
could not find expected ':'
The error appears to be in '/Users/pantelis/path/to/my/encrypted/file': line 6, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
Run Code Online (Sandbox Code Playgroud)
我存储这个多行变量的方式有问题吗?
块值需要比键缩进得更远。
my_private_key: |
-----BEGIN OPENSSH PRIVATE KEY-----
kd02ke0ke0k20ke0ke40430940943090494
Xekrfmfimimfimfeimiefmim4304309430943==
-----END OPENSSH PRIVATE KEY-----
Run Code Online (Sandbox Code Playgroud)