如何使用 ansible-vault 2.3.0 解密字符串 [英] How to decrypt string with ansible-vault 2.3.0
问题描述
我一直在等待 ansible 2.3,因为它将引入 encrypt_string 功能.
I have been waiting for ansible 2.3 as it was going to introduce encrypt_string feature.
不幸的是,我不确定如何读取加密的字符串.
Unfortuately I'm not sure how can I read the encrypted string.
我确实尝试过decrypt_string、解密(文件)、查看(文件),但没有任何效果.
I did try decrypt_string, decrypt (the file), view (the file) and nothing works.
cat test.yml
---
test: !vault |
$ANSIBLE_VAULT;1.1;AES256
37366638363362303836383335623066343562666662386233306537333232396637346463376430
3664323265333036663736383837326263376637616466610a383430623562633235616531303861
66313432303063343230613665323930386138613334303839626131373033656463303736366166
6635346135636437360a313031376566303238303835353364313434363163343066363932346165
6136
我遇到的错误是ERROR!输入不是 test.yml 的保险库加密数据
如何解密字符串以便我知道它的价值而无需运行播放?
How can I decrypt the string so I know what it's value without the need to run the play?
推荐答案
您是否尝试将加密字符串设置为变量,然后使用 -debug
获取其解密输出?
Did you try setting the encrypted string as a variable and then using -debug
to get its decrypted output?
即
将您的加密字符串定义为您的剧本中的变量 test
然后执行:
Define your encrypted string as a variable test
in your playbook and then do:
-debug: msg="My Secret value is {{test | replace('\n', '')}}"
在你的剧本中,然后运行剧本:
in your playbook and then run the playbook:
$ ansible-playbook -i localhost YourPlaybook.yml --vault-password-file path/to/your/secret_key_file
这篇关于如何使用 ansible-vault 2.3.0 解密字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!