Hello,
I have this code to add the Chrome repository:
- name: Add Chrome repository
become: true
ansible.builtin.apt_repository:
repo: deb [arch=amd64 signed-by=/etc/apt/keyrings/linux_signing_key.pub] http://dl.google.com/linux/chrome/deb/ stable main
state: present
filename: google-chrome
It works fine on Debian 12 Bookworm but on a fresh Linux Mint install it gives this error:
fatal [localhost]: FAILED! = {“changed”: false, “msg”: “Failed to lock directory /var/lib/apt/lists/: E: Could not get lock /var/lib/apt/lists/lock. It is held by process 42190 (python3)”
The error message is self-explanatory, however, I want to mention that this is a fresh Mint installation with only Ansible installed. Encountering such an error is concerning because the user who will execute the process may lack the expertise to troubleshoot Linux. I want the automation to ensure that everything is configured correctly immediately after installation. Is there a way to address the lock issue directly through Ansible?
Thank you.