I have a few Ubuntu 20.04 servers that I want to update using Ansible, but a simple task as apt update
is failing.
Ansible:
---
- name: Debugging
hosts: all
gather_facts: false
become: true
tasks:
- name: Run just apt update
ansible.builtin.apt:
update_cache: true
It fails with the following:
fatal: [<hostname>]: FAILED! => {“changed”: false, “msg”: “Failed to update apt cache: unknown reason”}
When running sudo apt update
manually on the hosts in runs without any errors:
$ sudo apt update
Hit:1 https://<repo url>/repository/apt-ubuntu focal InRelease
Hit:2 https://<repo url>/repository/apt-ubuntu focal-updates InRelease
Hit:3 https://<repo url>/repository/apt-ubuntu focal-backports InRelease
Hit:4 https://<repo url>/repository/apt-ubuntu focal-security InRelease
Hit:5 https://<repo url>/repository/apt-salt-focal-3004 focal InRelease
Hit:6 http://<repo url 2>/debian-octopus focal InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
$
So no gpg errors or failing repositories. What could cause this?