:) yeah that did it. How could I have missed it !!! Thanks for the
clarification.


On Thu, May 29, 2014 at 3:23 PM, Frédéric Badel <[email protected]> wrote:

> IMHO “sudo_user: vagrant” means that you’re running “sudo -u vagrant …”,
> therefore you’re not running this command as root.
> Try to remove the “sudo_user:” from your playbook.
>
> Cheers,
>
> Fred
>
>
>
> On May 29, 2014, at 21:10 , Kaji Bikash <[email protected]> wrote:
>
> For last 2 days, i have been struggling with a rather puzzling issue. I
> have installed/uninstalled ansible multiple times suspecting it might be
> the issue with the installation itself. But all in vain. I tried multiple
> versions of ansible already in ubuntu but no issue as such. Please help
>
> ~/a/p/statserver git:master ❯❯❯ cat hosts
>                                                                  ✱ ◼
> 192.168.33.12 ansible_ssh_port=22
> ~/a/p/statserver git:master ❯❯❯ cat test.yml
>                                                                   ✱ ◼
> ---
> - hosts: all
>   sudo: True
>   user: vagrant
>   sudo_user: vagrant
>   port: 22
>   tasks:
>       - name: Test apt
>         apt: update_cache=yes
> ~/a/p/statserver git:master ❯❯❯ ansible -i hosts -a 'apt-get install htop'all
> -u vagrant                                                  ✱ ◼
> 192.168.33.12 | FAILED | rc=100 >>
> E: Could not open lock file /var/lib/dpkg/lock - open (13: Permissiondenied
> )
> E: Unable to lock the administration directory (/var/lib/dpkg/), are you
> root?
>
>
> ~/a/p/statserver git:master ❯❯❯ ansible -i hosts -a 'apt-get install htop'all
> -u vagrant -s                                             ⏎ ✱ ◼
> 192.168.33.12 | success | rc=0 >>
> Reading package lists...
> Building dependency tree...
> Reading state information...
> htop is already the newest version.
> 0 upgraded, 0 newly installed, 0 to remove and 160 not upgraded.
>
> So it looks good. But when i do via playbook , it all fails with "msg:
> Failed to lock apt for exclusive operation"
>
> ~/a/p/statserver git:master ❯❯❯ ansible-playbook -i hosts test.yml -vvv
>                                                                  ✱ ◼
>
>
> PLAY [all]
> ********************************************************************
>
>
> GATHERING FACTS
> ***************************************************************
> <192.168.33.12> ESTABLISH CONNECTION FOR USER: vagrant
> <192.168.33.12> REMOTE_MODULE setup
> <192.168.33.12> EXEC ['ssh', '-C', '-tt', '-q', '-o', 'ForwardAgent=yes',
> '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o',
> 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey'
> , '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o',
> 'ConnectTimeout=10', '192.168.33.12', "/bin/sh -c 'mkdir -p
> /tmp/ansible-tmp-1401390504.11-150057298374102 && chmod a+rx
> /tmp/ansible-tmp-1401390504.11-150057298374102 && echo
> /tmp/ansible-tmp-1401390504.11-150057298374102'"]
> <192.168.33.12> PUT /var/folders/fv/gpzlv1jd3bd3s6sw57q0smr00000gn/T/tmpbcpfOS
> TO /tmp/ansible-tmp-1401390504.11-150057298374102/setup
> <192.168.33.12> EXEC ['ssh', '-C', '-tt', '-q', '-o', 'ForwardAgent=yes',
> '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o',
> 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey'
> , '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o',
> 'ConnectTimeout=10', '192.168.33.12', "/bin/sh -c 'chmod a+r
> /tmp/ansible-tmp-1401390504.11-150057298374102/setup'"]
> <192.168.33.12> EXEC ['ssh', '-C', '-tt', '-q', '-o', 'ForwardAgent=yes',
> '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o',
> 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey'
> , '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o',
> 'ConnectTimeout=10', '192.168.33.12', u"/bin/sh -c 'LC_CTYPE=en_US.UTF-8
> LANG=en_US.UTF-8 /usr/bin/python
> /tmp/ansible-tmp-1401390504.11-150057298374102/setup; rm -rf
> /tmp/ansible-tmp-1401390504.11-150057298374102/ >/dev/null 2>&1'"]
> <192.168.33.12> EXEC ['ssh', '-C', '-tt', '-q', '-o', 'ForwardAgent=yes',
> '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o',
> 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey'
> , '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o',
> 'ConnectTimeout=10', '192.168.33.12', "/bin/sh -c 'rm -rf
> /tmp/ansible-tmp-1401390504.11-150057298374102/ >/dev/null 2>&1'"]
> ok: [192.168.33.12]
>
>
> TASK: [Test apt]
> **************************************************************
> <192.168.33.12> ESTABLISH CONNECTION FOR USER: vagrant
> <192.168.33.12> REMOTE_MODULE apt update_cache=yes
> <192.168.33.12> EXEC ['ssh', '-C', '-tt', '-q', '-o', 'ForwardAgent=yes',
> '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o',
> 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey'
> , '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o',
> 'ConnectTimeout=10', '192.168.33.12', "/bin/sh -c 'mkdir -p
> /tmp/ansible-tmp-1401390504.64-61942463115394 && chmod a+rx
> /tmp/ansible-tmp-1401390504.64-61942463115394 && echo
> /tmp/ansible-tmp-1401390504.64-61942463115394'"]
> <192.168.33.12> PUT /var/folders/fv/gpzlv1jd3bd3s6sw57q0smr00000gn/T/tmpQeaBWx
> TO /tmp/ansible-tmp-1401390504.64-61942463115394/apt
> <192.168.33.12> EXEC ['ssh', '-C', '-tt', '-q', '-o', 'ForwardAgent=yes',
> '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o',
> 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey'
> , '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o',
> 'ConnectTimeout=10', '192.168.33.12', "/bin/sh -c 'chmod a+r
> /tmp/ansible-tmp-1401390504.64-61942463115394/apt'"]
> <192.168.33.12> EXEC ['ssh', '-C', '-tt', '-q', '-o', 'ForwardAgent=yes',
> '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o',
> 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey'
> , '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o',
> 'ConnectTimeout=10', '192.168.33.12', u"/bin/sh -c 'LC_CTYPE=en_US.UTF-8
> LANG=en_US.UTF-8 /usr/bin/python
> /tmp/ansible-tmp-1401390504.64-61942463115394/apt'"]
> <192.168.33.12> EXEC ['ssh', '-C', '-tt', '-q', '-o', 'ForwardAgent=yes',
> '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o',
> 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey'
> , '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o',
> 'ConnectTimeout=10', '192.168.33.12', "/bin/sh -c 'rm -rf
> /tmp/ansible-tmp-1401390504.64-61942463115394/ >/dev/null 2>&1'"]
> failed: [192.168.33.12] => {"failed": true}
> msg: Failed to lock apt for exclusive operation
>
>
> FATAL: all hosts have already failed -- aborting
>
>
> PLAY RECAP
> ********************************************************************
>            to retry, use: --limit @/Users/kaji/test.retry
>
>
> 192.168.33.12              : ok=1    changed=0    unreachable=0    failed=
> 1
>
> https://asciinema.org/a/9866
>
> Thanks in advance
>
> --
> Kaji
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c16b3225-f6d6-4926-9b2c-b0039b85d072%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/c16b3225-f6d6-4926-9b2c-b0039b85d072%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/JG-f1fBHCck/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CF0CFAE4-ADCF-4E51-AABB-5D505368F9EE%40never-mind.ch<https://groups.google.com/d/msgid/ansible-project/CF0CFAE4-ADCF-4E51-AABB-5D505368F9EE%40never-mind.ch?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALxEhbvdnfP93tzs3Eg43j4EXRrkmzOMTK-rukFNJr%3D5OhR3vg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to