Good morning, my friends.
I’m having an error happening on Ansible when I run the playbook below:
- hosts: all
become: yes
become_method: sudo
become_user: ansible
gather_facts: yes
tasks:
- name: Installing Updates Ubuntu Servers
apt:
update_cache: true
This error appears:
fatal: [192.168.0.82]: FAILED! = “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” \ nW: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied) \ nE: Unable to lock directory / var / lib / apt / lists /cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied) “,” rc “: 100,” stderr “:” E: Could not open lock file / var / lib / apt / : Permission denied) \ nE: Unable to lock directory / var / lib / apt / lists / \ nW: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied) \ nW: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied) \ n “,” stderr_lines “: [” E: Could not open lock file / var / lib / apt / 13: Permission denied “,” E: Unable to lock directory / var / lib / apt / lists / “,” W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied) “,” W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied) “,” stdout “:” Reading package lists … \ n “,” stdout_lines “: [” Reading package lists … "]}
I need to deploy on a server network with the same configuration as this one. Can you help me please?
Sorry.
Corret Mensage error:
fatal: [192.168.0.82]: FAILED! => {“changed”: false, “cmd”: “apt-get update”, “msg”: “E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)\nE: Unable to lock directory /var/lib/apt/lists/\nW: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)\nW: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)”, “rc”: 100, “stderr”: “E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)\nE: Unable to lock directory /var/lib/apt/lists/\nW: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)\nW: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)\n”, “stderr_lines”: [“E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)”, “E: Unable to lock directory /var/lib/apt/lists/”, “W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)”, “W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)”], “stdout”: “Reading package lists…\n”, “stdout_lines”: [“Reading package lists…”]}
You have become_user ansible, only root user is allowed to install packages.
>
> My friend, thank you very much. Run as root(same password on client e
> server).
>
> this message is displayed:
Have you read the message?
It clearly states what's wrong.
> fatal: [192.168.0.82]: FAILED! => {"changed": false, "cmd": "apt-get
> update", "msg": "W: GPG error: https://dl.bintray.com/wso2/deb ei_640
> Release: The following signatures couldn't be verified because the public
> key is not available: NO_PUBKEY 379CE192D401AB61\nE: The repository '
> https://dl.bintray.com/wso2/deb ei_640 Release' is not signed.", "rc":
This isn't an Ansible problem at all since you are missing gpg key for some repositories.