Permission denied using ansible-vault edit

1,297 views
Skip to first unread message

Kesten Broughton

unread,
Feb 27, 2014, 2:02:33 PM2/27/14
to ansible...@googlegroups.com

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/<file> 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 <module>

    from ansible import utils

ImportError: No module named ansible


[kbroughton@mb-kbroughton:lynx-ansible/dev-ansible + (develop)] ansible --version

ansible 1.5 (devel 312cda0d7c) last updated 2014/02/25 17:27:18 (GMT -500)




On Thu, Feb 27, 2014 at 10:41 AM, <ansible...@googlegroups.com> wrote:

Group: http://groups.google.com/group/ansible-project/topics

    Marc Trudel <mtr...@wizcorp.jp> Feb 26 08:49PM -0800  

    Some feedback
     
    I tried a few things still to make it perform better, including mirror
    repositories, but the fact that repoquery is forced on the user is perhaps
    limiting... any ways to make that ...more

    Back to top

    Michael DeHaan <mic...@ansible.com> Feb 27 08:15AM -0500  

    We've been through this discussion a bit before, and we believe the
    repoquery needs to be there.
     
    I'm a bit more curious about why you are spending so much time in the
    operation and most people ...more

    Back to top

    Mark Butler <markhen...@gmail.com> Feb 26 06:05PM -0800  

    Hi team,
     
    i need to download and deploy some jars using Ansible from Jenkins. Some of
    our jars with dependencies are large (150mb) so this is slow.
     
    Is there anyway i can check if and only ...more

    Back to top

    Adam Morris <zwac...@gmail.com> Feb 26 08:06PM -0800  

    On Wednesday, February 26, 2014 6:05:26 PM UTC-8, Mark Butler wrote:
     
    > i need to download and deploy some jars using Ansible from Jenkins. Some
    > of our jars with dependencies are large (150mb) ...more

    Back to top

    i iordanov <iior...@gmail.com> Feb 26 04:36PM -0800  

    Here is a sample failure message:
     
    fatal: [u05] => Authentication or permission failure. In some cases, you
    may have been able to authenticate and did not have permissions on t ...more

    Back to top

    i iordanov <iior...@gmail.com> Feb 26 04:48PM -0800  

    For the record, I'm using Ansible 1.4.5 built with "make deb" after a "git
    checkout v1.4.5" in the repository.
    ...more

    Back to top

    Michael DeHaan <mic...@ansible.com> Feb 26 07:49PM -0500  

    Was just going to ask what version and you beat me to it :)
     
    There was a problem with the copy module not removing tempfiles that was
    recently fixed (Feb 4), though we haven't included this in a ...more

    Back to top

    i iordanov <iior...@gmail.com> Feb 26 04:54PM -0800  

    Hi Michael,
     
    On Wednesday, February 26, 2014 7:49:04 PM UTC-5, Michael DeHaan wrote:
     
    > Was just going to ask what version and you beat me to it :)
     
    :)

     
    > Ansible 1.5 is slated to be ...more

    Back to top

    Paul Durivage <pauldu...@gmail.com> Feb 26 10:59AM -0600  

    If you so choose, you could add a task to the role to ensure the system is
    a 64-bit system.
     
    - name: "Ensure system is x86_64"
    fail: msg="Docker requires a 64bit system architecture" ...more

    Back to top

    Jeremy Schulman <nwkaut...@gmail.com> Feb 26 09:21AM -0800  

    Hi,
     
    I ran across this same "not issue" thinking that my host_vars/x.yml would
    override the inventory file. I get the Ansible Zen approach, and now that
    I know the answer from MD above, I am ...more

    Back to top

    Petr Sukharev <st.i...@gmail.com> Feb 26 09:11AM -0800  

    Solved by myself.
     
    Use trick with
     
    shell={{ variable | default('/bin/sh') }} value.
     
    Thanks a lot for help!
    ...more

    Back to top

    anatoly techtonik <tech...@gmail.com> Feb 26 07:49PM +0300  

    I still don't understand. There are different levels of variables, but
    how do they stacked and overriden?
     
    Is it like this? (I can't check right now)
     
    [globals] (-e) - ...more

    Back to top

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/047d7b8747c498715904f365fd9f%40google.com.
For more options, visit https://groups.google.com/groups/opt_out.



--

Kesten Broughton
512 701 4209

James Tanner

unread,
Feb 27, 2014, 2:32:47 PM2/27/14
to ansible...@googlegroups.com
Can you try setting EDITOR to vi, vim, or nano ?


Tim Gerla

unread,
Feb 27, 2014, 2:46:53 PM2/27/14
to ansible...@googlegroups.com
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

Kesten Broughton

unread,
Feb 28, 2014, 1:52:59 PM2/28/14
to ansible...@googlegroups.com
That was precisely the problem.
export EDITOR=nano 
works fine.
An ansible vault plugin for sublime... sounds nice.
Reply all
Reply to author
Forward
0 new messages