Playbook error-- "Failed to lock apt for exclusive operation"

29 views
Skip to first unread message

Dhamodharan D

unread,
Jul 23, 2019, 5:29:45 AM7/23/19
to Ansible Project
Hi All,

I have configured ansible properly with 1 master and 1 node machine. Have configured the /etc/ansible/hosts file with

[webservers]
172.31.xx.xx ansible_ssh_user=ansibleuser ansible_ssh_pass=passwd.

and have written my playbook for installing apache webserver in node machine.


playerror.PNG

After execting my playbook, I am getting this error.

Note: When I execute the same playbook on hosts: localhost. its working fine.

Can somone help me to fix the issue.

Thanks.

Regards,
Dhamodharan.

Dick Visser

unread,
Jul 23, 2019, 5:38:25 AM7/23/19
to ansible...@googlegroups.com
This usually happens when there is another apt operation going on.
I sometimes have this if I spin up an instance from an image that is a
bit old and it has to download a lot of security updates.

Dick


On Tue, 23 Jul 2019 at 11:29, Dhamodharan D <dhaamo...@gmail.com> wrote:
>
> Hi All,
>
> I have configured ansible properly with 1 master and 1 node machine. Have configured the /etc/ansible/hosts file with
>
> [webservers]
> 172.31.xx.xx ansible_ssh_user=ansibleuser ansible_ssh_pass=passwd.
>
> and have written my playbook for installing apache webserver in node machine.
>
>
> After execting my playbook, I am getting this error.
>
> Note: When I execute the same playbook on hosts: localhost. its working fine.
>
> Can somone help me to fix the issue.
>
> Thanks.
>
> Regards,
> Dhamodharan.
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/634ce19b-5ae3-475d-870b-24338f3882cd%40googlegroups.com.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

Dhamodharan D

unread,
Jul 23, 2019, 5:46:43 AM7/23/19
to Ansible Project
Hi Dick,

Thanks for your revert, but I dont have any other apt operation running on my machine. Its a fresh machine and just configured for ansible operation and tried apache configuration in my ansible node. 


On Tuesday, July 23, 2019 at 3:08:25 PM UTC+5:30, Dick Visser wrote:
This usually happens when there is another apt operation going on.
I sometimes have this if I spin up an instance from an image that is a
bit old and it has to download a lot of security updates.

Dick


On Tue, 23 Jul 2019 at 11:29, Dhamodharan D <dhaamo...@gmail.com> wrote:
>
> Hi All,
>
> I have configured ansible properly with 1 master and 1 node machine. Have configured the /etc/ansible/hosts file with
>
> [webservers]
> 172.31.xx.xx ansible_ssh_user=ansibleuser ansible_ssh_pass=passwd.
>
> and have written my playbook for installing apache webserver in node machine.
>
>
> After execting my playbook, I am getting this error.
>
> Note: When I execute the same playbook on hosts: localhost. its working fine.
>
> Can somone help me to fix the issue.
>
> Thanks.
>
> Regards,
> Dhamodharan.
>
> --
> 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...@googlegroups.com.

Dick Visser

unread,
Jul 23, 2019, 6:37:29 AM7/23/19
to ansible...@googlegroups.com
I assume you have become=yes?
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/87976546-f30b-407f-b6e7-c294e06f9447%40googlegroups.com.

Dhamodharan D

unread,
Jul 23, 2019, 6:45:54 AM7/23/19
to ansible...@googlegroups.com
That also I have tried, even tried with sudo=yes, become_user=yes, remote_user=<username>.

Nothing worked out..



--
Thanks & Regards,
Dhamodharan,
Bangalore.

Dhamodharan D

unread,
Jul 23, 2019, 6:47:11 AM7/23/19
to Ansible Project
That also I have tried, even tried with sudo=yes, become_user=yes, remote_user=<username>.

Nothing worked out..

Dick Visser

unread,
Jul 23, 2019, 7:24:25 AM7/23/19
to ansible...@googlegroups.com
On Tue, 23 Jul 2019 at 12:45, Dhamodharan D <dhaamo...@gmail.com> wrote:
>
> That also I have tried, even tried with sudo=yes, become_user=yes, remote_user=<username>.
>
> Nothing worked out..

I would expect that when trying combinations of (partially outdated)
privilege escalation directives and random values.
However, it does indicate that privilege escalation _is_ the actual
problem though.

Please take a few minutes to read
https://docs.ansible.com/ansible/latest/user_guide/become.html, and
adjust your playbook and ansible invocation accordingly.

Dick
Reply all
Reply to author
Forward
0 new messages