I am using the command line tool ansible-vault and try to edit an encrypted file.
EDITOR=code ansible-vault edit test.txt
It is expected that code opens with the decrypted content in the editor. After saving ansible-vault should decrypt the (changed) buffer. Works much like editing a git commit message.
However, the buffer is empty. And changing/saving doesn't do much to the file.
I also tried it with vim and subl, which both worked as expected. What do I have to do to use visual-studio-code for the task?
When you need to edit an encrypted file, use the ansible-vault edit command: ansible-vault edit vault. yml.
To enable this feature, a command line tool - ansible-vault - is used to edit files, and a command line flag ( --ask-vault-pass , --vault-password-file or --vault-id ) is used.
If you have an encrypted file that you no longer want to keep encrypted, you can permanently decrypt it by running the ansible-vault decrypt command. This command will save the file unencrypted to the disk, so be sure you do not want to edit it instead.
To decrypt open the command prompt and type “Decrypt”.
Found it out. I need to:
EDITOR='code --wait' ansible-vault edit test.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With