Search code examples
ansibleapt-getpackage-management

ansible-playbook: "Failed to update cache: unknown reason"


I am trying to deploy kypo cyber range and am following its official guide. While deploying the whole range using ansible-playbook, I am stuck on above error:

TASK [docker : install prerequisites] ******************************************************************
fatal: [192.168.211.208]: FAILED! => {"changed": false, "msg": "Failed to update apt cache: unknown reason"}

I have manually checked apt-get update which initially gave me a notification of:

N: Skipping acquire of configured file 'stable/binary-i386/Packages' as repository 'https://download.docker.com/linux/ubuntu focal InRelease' doesn't support architecture 'i386'

I followed this to add [amd=64] to repository which cleaned the error. Now apt-get update runs with without any warnings or errors, but ansible-playbook keeps on generating this error.

I changed the verbosity level and got:

fatal: [192.168.211.208]: FAILED! => {
    "changed": false,
    "invocation": {
       "module_args": {
            "allow_unauthenticated": false,
            "autoclean": false,
            "autoremove": false,
            "cache_valid_time": 0,
            "deb": null,
            "default_release": null,
            "dpkg_options": "force-confdef,force-confold",
            "force": false,
            "force_apt_get": false,
            "install_recommends": null,
            "name": [
                "apt-transport-https",
                "ca-certificates"
            ],
            "only_upgrade": false,
            "package": [
                "apt-transport-https",
                "ca-certificates"
            ],
            "policy_rc_d": null,
            "purge": false,
            "state": "present",
            "update_cache": true,
            "update_cache_retries": 5,
            "update_cache_retry_max_delay": 12,
            "upgrade": null
        }
    },
    "msg": "Failed to update apt cache: unknown reason"
 }

How can I fix this?


Solution

  • In Kypo CRP, while playing the ansible playbook the error was actually coming from one of the instances of openstack which I found out by increasing verbosity in command -vvvv. Everything was fine with the host machine. So I look for changes in instances and the root cause was there was no internet access. Once I managed to connect them to external world, the error went away.