При запуске команды ansible-playbook install_iot.yml выполняется ряд задач записанных в playbook install_iot.yml, одна из которых:
TASK [Remove old versions of docker for Ubuntu]
отвечающая за проверку и удаление старых версий docker. При первой установке платформы, ansible добавляет ключ для скачивания docker из официальных репозиториев, который может изменится, что приводит к ошибке:
TASK [Remove old versions of docker for Ubuntu] *********************************************************************************************************************************************************** failed: [localhost] (item=docker-compose) => {"ansible_loop_var": "item", "changed": false, "item": "docker-compose", "msg": "Failed to update apt cache: unknown reason"} failed: [localhost] (item=docker) => {"ansible_loop_var": "item", "changed": false, "item": "docker", "msg": "Failed to update apt cache: unknown reason"} failed: [localhost] (item=docker-engine) => {"ansible_loop_var": "item", "changed": false, "item": "docker-engine", "msg": "Failed to update apt cache: unknown reason"} failed: [localhost] (item=docker.io) => {"ansible_loop_var": "item", "changed": false, "item": "docker.io", "msg": "Failed to update apt cache: unknown reason"} failed: [localhost] (item=containerd) => {"ansible_loop_var": "item", "changed": false, "item": "containerd", "msg": "Failed to update apt cache: unknown reason"} failed: [localhost] (item=runc) => {"ansible_loop_var": "item", "changed": false, "item": "runc", "msg": "Failed to update apt cache: unknown reason"} PLAY RECAP ************************************************************************************************************************************************************************************************ localhost : ok=9 changed=1 unreachable=0 failed=1 skipped=3 rescued=0 ignored=0
в качестве уточнения ошибки можно выполнить команду sudo apt update:
# apt update Hit:1 http://ru.archive.ubuntu.com/ubuntu focal InRelease Hit:2 http://ru.archive.ubuntu.com/ubuntu focal-updates InRelease Hit:3 http://ppa.launchpad.net/ansible/ansible/ubuntu focal InRelease Hit:4 http://ru.archive.ubuntu.com/ubuntu focal-backports InRelease Get:5 https://download.docker.com/linux/ubuntu focal InRelease [57.7 kB] Hit:6 http://ru.archive.ubuntu.com/ubuntu focal-security InRelease Err:5 https://download.docker.com/linux/ubuntu focal InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8 Fetched 57.7 kB in 1s (82.5 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 29 packages can be upgraded. Run 'apt list --upgradable' to see them. W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://download.docker.com/linux/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8 W: Failed to fetch https://download.docker.com/linux/ubuntu/dists/focal/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8 W: Some index files failed to download. They have been ignored, or old ones used instead.
в выводе команды видно ошибку The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
Исправить данную проблему можно следующим образом, следуя инструкции с официальном сайта docker https://docs.docker.com/engine/install/ubuntu/ . Нам нужен пункт Set up the repository
Add Docker’s official GPG key:
sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Use the following command to set up the repository:
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
теперь ключ добавлен и можно выполнять команду ansible-playbook install_iot.yml