When I run the command: ansible-playbook -i inventory/hosts lemmy.yml I encounter an error. My user on the server has passwordless root access, and it is a completely fresh install. I have updated and rebooted the system, as well as tried updating without rebooting and without updating, but I continue to receive the same error message. I am using the latest build from two weeks ago.

I am using Ubuntu server 22.04.


FAILED! => {"changed": false, "msg": "Failed to lock apt for exclusive operation: Failed to lock directory /var/lib/apt/lists/: E:Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)"}
  • Your own user might have root, but the ansibke user probably isn’t.
    You can enable ansible privilege escalation by adding become: true in your yaml file.

    It is likely safer in the long run to set it for a specific task than globally.

  • @nutomic@lemmy.ml
    link
    fedilink
    11 month ago

    You may be running apt upgrade in another terminal, or it didn’t complete properly in the past. Anyway it cannot install packages so you need to fix that.