Unsible 1.9.4: Failed to block the application for exclusive operation

I ran into a problem Failed to lock apt for exclusive operation: https://github.com/geerlingguy/ansible-role-apache/issues/50

I posted a lot of details on GitHub.

I googled a lot "Failed to block apt for exceptional operation." Complaints about complaints, but there is no simple answer. Any help?

+10
source share
8 answers

I also get this error by creating a couple of new mailboxes. I connect as root, so I did not think it was necessary, but this:

become: yes

Now everything works as intended.

+17
source

Running the following commands in the same sequence as below should solve this problem:

sudo rm -rf /var/lib/apt/lists/*
sudo apt-get clean
sudo apt-get update
+3

, , . update_cache. , - " apt". update_cache , :

- tasks:
  - name: update apt list
    apt:
      update_cache: yes
+3

@guaka . : become: yes.

, become. :

 - name: setup nginx web server
     #1 become: yes
     include_role:
       name: nginx
       #2 become: yes
     vars:
       ansible_user: "{{ devops_ssh_user }}"
       #3 become: yes

№2 , become include_role.

№3 , sudo.

# 1 become: yes - . become - , . ansible_user. , :

 - name: setup nginx web server
     become: yes
     include_role:
       name: nginx
     vars:
       ansible_user: "{{ devops_ssh_user }}"
+2

hosts , sudo, , Ansible SSH, ansible_user ansible_become_user .

, ansible_user == ansible_become_user Failed to lock apt for exclusive operation.

ansible_become_user , .

+1

, Ansible, SSH . , apt Debian . Docker VM, , APT.

0

remote_user: root , . , , , ( ). remote_user: root, . --become --become-user=root. ( , - .)

0

https://serverfault.com/questions/716260/ansible-sudo-error-while-building-on-atlas

  Check the output ps aux | grep aptfor suspicious processes.

0
source

Source: https://habr.com/ru/post/1614699/


All Articles