我正在使用 ansible 2.7.16。
ansible 文档说:
Single Encrypted Variable
As of version 2.3, Ansible can now use a vaulted variable that lives in an otherwise ‘clear text’ YAML file:
notsecret: myvalue
mysecret: !vault |
$ANSIBLE_VAULT;1.1;AES256
66386439653236336462626566653063336164663966303231363934653561363964363833313662
6431626536303530376336343832656537303632313433360a626438346336353331386135323734
62656361653630373231613662633962316233633936396165386439616533353965373339616234
3430613539666330390a313736323265656432366236633330313963326365653937323833366536
34623731376664623134383463316265643436343438623266623965636363326136
other_plain_text: othervalue
我有以下 .yml 文件:
user: dbuser
pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
33633131346338633461336438656463643539396535656432306564636466353338373135346166
3838313236383739616239333265323131376231656633350a613333613239646263393330353930
31303935646330643831396130343031613063393839353433646338343034386432656435623934
6537356530643136310a373835323666393337346562613831613962323261346232323331343631
3838
我想得到一个解密的文件,然后我尝试了命令:
ansible-playbook --vault-password-file pass.txt config.yml
但我收到以下错误:
[WARNING]: Unable to parse /etc/ansible/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! playbooks must be a list of plays
The error appears to have been in '/tmp/config.yml': line 1, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
user: dbuser
^ here
我怎样才能获得解密变量的 .yml 文件?