Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ansible vault doesn't save changes with Sublime Text

I'm running ansible 1.9.4 on OSX installed via pip.

If I do ansible-vault create x, then make some changes and save, then the file appears blank whenever I do ansible-vault view x or ansible-vault edit x.

I've got Sublime Text 3 as my $EDITOR. When I set it to vim instead, it all works as expected, and I can edit and save my files encrypted with ansible-vault. Any idea what could be happening here?

like image 680
joshua.paling Avatar asked Dec 11 '22 20:12

joshua.paling


1 Answers

I don't think it'll work with the standard Sublime command line launcher. ansible-vault waits for the editor process to exit before encrypting the temp file it creates- the Sublime launcher exits immediately, so you end up with an empty vault file.

EDIT:

To make it work with the standard Sublime command line launcher, you have to specify the -w flag, which will stop the subl process from existing until the file is closed in sublime text. (see docs)

So your .bashrc should have a line like this:

export EDITOR='subl -w'
like image 180
nitzmahone Avatar answered Jan 06 '23 18:01

nitzmahone