From 08ae86e0b5fc3e891e9122b138e6d580e3c2f0f1 Mon Sep 17 00:00:00 2001 From: Omkar Kawade Date: Mon, 18 Dec 2023 11:06:21 -0800 Subject: [PATCH] 434 update apt key destination --- defaults/main.yml | 2 +- tasks/setup-Debian.yml | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index daad48f..cdf94f0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -38,7 +38,7 @@ docker_apt_release_channel: stable # and is only necessary until Docker officially supports them. docker_apt_ansible_distribution: "{{ 'ubuntu' if ansible_distribution in ['Pop!_OS', 'Linux Mint'] else ansible_distribution }}" docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}" -docker_apt_repository: "deb [arch={{ docker_apt_arch }} signed-by=/etc/apt/keyrings/docker.gpg] {{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" +docker_apt_repository: "deb [arch={{ docker_apt_arch }} signed-by=/etc/apt/keyrings/docker.asc] {{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" docker_apt_ignore_key_error: true docker_apt_gpg_key: "{{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }}/gpg" docker_apt_gpg_key_checksum: "sha256:1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570" diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 7a3cb03..2415cb1 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -33,13 +33,16 @@ state: directory mode: '0755' -- name: Ensure curl is present - package: name=curl state=present - -- name: Add Docker apt key - shell: > - curl -fsSL {{ docker_apt_gpg_key }} | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg --yes - changed_when: false +- name: Add Docker apt key. + ansible.builtin.get_url: + url: "{{ docker_apt_gpg_key }}" + dest: /etc/apt/keyrings/docker.asc + mode: '0644' + force: false + checksum: "{{ docker_apt_gpg_key_checksum | default(omit) }}" + register: add_repository_key + ignore_errors: "{{ docker_apt_ignore_key_error }}" + when: docker_add_repo | bool - name: Change permissions for /etc/apt/keyrings/docker.gpg file: