Permission denied using ansible-vault edit

I can encrypt and decrypt but i haven’t been able to get edit to work.

I’m running on a mac. In my bash_profile i have aliases to sublime

---------- .bash_profile --------------

alias edit=‘/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl’

a sudo version for when you need to edit /opt/ or other sudo owned files

alias sedit=‘sudo /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl’

define EDITOR or ansible-vault

Tried several things

export EDITOR=edit # Command not found

alias EDITOR=edit # Permission denied

alias EDITO=sedit

---------- end .bash_profile --------------

**[**kbroughton@mb-kbroughton:lynx-ansible/dev-ansible + (develop)] ansible-vault encrypt sudoers

Vault password:

Confirm Vault password:

Encryption successful

**[**kbroughton@mb-kbroughton:lynx-ansible/dev-ansible + (develop)] ansible-vault decrypt sudoers

Vault password:

Decryption successful

**[**kbroughton@mb-kbroughton:lynx-ansible/dev-ansible + (develop)] ansible-vault edit -d sudoers

Vault password:

Traceback (most recent call last):

File “/Users/kbroughton/vcp/git/mentat/ansible/bin/ansible-vault”, line 182, in main

fn(args, options, parser)

File “/Users/kbroughton/vcp/git/mentat/ansible/bin/ansible-vault”, line 141, in execute_edit

this_editor.edit_file()

File “/Users/kbroughton/vcp/git/mentat/ansible/lib/ansible/utils/vault.py”, line 188, in edit_file

call([EDITOR, tmp_path])

File “/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 522, in call

return Popen(*popenargs, **kwargs).wait()

File “/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 709, in init

errread, errwrite)

File “/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 1326, in _execute_child

raise child_exception

OSError: [Errno 13] Permission denied

ERROR: [Errno 13] Permission denied

**[**kbroughton@mb-kbroughton:lynx-ansible/dev-ansible + (develop)] alias EDITOR=sedit

**[**kbroughton@mb-kbroughton:lynx-ansible/dev-ansible + (develop)] ansible-vault edit -d sudoers

Vault password:

Traceback (most recent call last):

File “/Users/kbroughton/vcp/git/mentat/ansible/bin/ansible-vault”, line 182, in main

fn(args, options, parser)

File “/Users/kbroughton/vcp/git/mentat/ansible/bin/ansible-vault”, line 141, in execute_edit

this_editor.edit_file()

File “/Users/kbroughton/vcp/git/mentat/ansible/lib/ansible/utils/vault.py”, line 188, in edit_file

call([EDITOR, tmp_path])

File “/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 522, in call

return Popen(*popenargs, **kwargs).wait()

File “/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 709, in init

errread, errwrite)

File “/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 1326, in _execute_child

raise child_exception

OSError: [Errno 13] Permission denied

ERROR: [Errno 13] Permission denied

Also tried as sudo user

**[**kbroughton@mb-kbroughton:lynx-ansible/dev-ansible + (develop)] sudo ansible-vault edit -d sudoers

Traceback (most recent call last):

File “/Users/kbroughton/vcp/git/mentat/ansible/bin/ansible-vault”, line 27, in

from ansible import utils

ImportError: No module named ansible

Can you try setting EDITOR to vi, vim, or nano ?

This might be tough to get working because “subl” returns immediately to the shell after opening the file, which means ansible-vault can’t re-encrypt after you’re done editing. You should probably stick with encrypt/decrypt and editing manually. What would be really cool is a Sublime Text plugin for vault!

-Tim

That was precisely the problem.
export EDITOR=nano
works fine.
An ansible vault plugin for sublime… sounds nice.