From 69274cdbbfd1699de43910aff30e2b822147d3e0 Mon Sep 17 00:00:00 2001 From: tziuhtli <219232409+tziuhtli@users.noreply.github.com> Date: Sat, 12 Jul 2025 01:39:06 +1000 Subject: [PATCH 1/2] Included the gpg package as requirements for Debian The gpg package is not present in debian cloud images and must be installed manually e.g. in https://cloud.debian.org/images/cloud the `generic` or `genericcloud` images. --- tasks/setup-Debian.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 253876b..d19e8e8 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -28,6 +28,7 @@ name: - apt-transport-https - ca-certificates + - gpg state: present when: docker_add_repo | bool From ab942b57e86fc5908b259135aff2c50186fdf5e7 Mon Sep 17 00:00:00 2001 From: tziuhtli <219232409+tziuhtli@users.noreply.github.com> Date: Sat, 12 Jul 2025 13:08:42 +1000 Subject: [PATCH 2/2] apt_repository depends on gpg Reordered tasks so that gpg is installed before apt_repository is called. --- tasks/setup-Debian.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index d19e8e8..f7a6082 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -9,6 +9,15 @@ path: "/etc/apt/sources.list.d/download_docker_com_linux_{{ docker_apt_ansible_distribution | lower }}.list" state: absent +- name: Ensure dependencies are installed. + apt: + name: + - apt-transport-https + - ca-certificates + - gpg + state: present + when: docker_add_repo | bool + - name: Ensure the repo referencing the previous trusted.gpg.d key is not present apt_repository: repo: "deb [arch={{ docker_apt_arch }} signed-by=/etc/apt/trusted.gpg.d/docker.asc] {{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" @@ -23,15 +32,6 @@ name: "{{ docker_obsolete_packages }}" state: absent -- name: Ensure dependencies are installed. - apt: - name: - - apt-transport-https - - ca-certificates - - gpg - state: present - when: docker_add_repo | bool - - name: Ensure directory exists for /etc/apt/keyrings file: path: /etc/apt/keyrings