ansible - 无法将多行字符串(私有 ssh 密钥)存储为 ansible 中的变量
问题描述
我正在尝试将ssh
私钥存储为ansible
变量。
它在一个加密文件中,它或多或少像这样
my_private_key: |
-----BEGIN OPENSSH PRIVATE KEY-----
kd02ke0ke0k20ke0ke40430940943090494
[...]
Xekrfmfimimfimfeimiefmim4304309430943==
-----END OPENSSH PRIVATE KEY-----
但是,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.
我存储这个多行变量的方式有问题吗?
解决方案
块值需要比键缩进更远。
my_private_key: |
-----BEGIN OPENSSH PRIVATE KEY-----
kd02ke0ke0k20ke0ke40430940943090494
Xekrfmfimimfimfeimiefmim4304309430943==
-----END OPENSSH PRIVATE KEY-----
推荐阅读
- firebase - 使用 React Native 对 Cloud Firestore 进行 Google 身份验证
- python - 从给定序列构建 N 阶马尔可夫转移矩阵
- javascript - 在部署 Firebase 云函数时收到“每个都应该返回一个值或抛出”错误
- amazon-web-services - 将数据从 sqs 移动到 s3
- javascript - vue.js mapbox 地图未显示
- ios - 如何知道一个 URL 是否有效并检查它是否会在 swift 中打开
- android - 无法在 firebase 数据库中插入数据
- ios - 在 SwiftUI 中将文本和图像添加到按钮
- python - DBAPI 错误;SSL SYSCALL 错误:运行 docker 映像时检测到 EOF
- node.js - 在 node.js 服务器中的 url 中搜索查询