I have ansible files that are encrypted using ansible-vault. I want to decrypt, edit, and save encrypted these files from within an IDEA IDE, in this case, pycharm.
I have created an external tool in pycharm that will decrypt the files and open them in a run window in the IDE in what appears to be a tmp file. I need the output of the tool to be placed in an edit tab and save it to same file.
Here is how I created the external tool:
Preferences -> External Tools -> New
Name: Vault Edit
Group: Ansible
Options: Synchronise files after execution, Open console
Show in: Main menu, Editor Menu
Tool Settings:
Programs: /path/to/vault_edit.sh
Parameters: edit $FileName$
workding directory: $FileDir$
vault_edit.sh
#!/bin/sh
EDITOR=charm
ansible-vault --vault-password-file=~/.vault/vault_password.txt "$@"
The run
window is showing the decrypted output, but it of course is not allowing me to edit the file, let alone save it. I can't find any documentation on how to push the output of the ansible-vault to a tabbed edit window in pycharm.
It is showing output like:
/path/to/vault_edit.sh edit hosts
Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal
If I can get this working, I plan on doing something similar to allow for encryption of a file as well.