mirror of
https://github.com/geerlingguy/ansible-role-docker.git
synced 2025-08-15 13:48:28 +02:00
Update setup-Debian.yml
Update to remove apt_key. This module is deprecated, and this is the Debian guideline workaround until https://github.com/ansible/ansible/pull/77340 is released. Further info: https://www.reddit.com/r/ansible/comments/u2vy26/comment/i4pbgj9/
This commit is contained in:
parent
5b8e39b38e
commit
8d958fd394
@ -25,27 +25,31 @@
|
|||||||
state: present
|
state: present
|
||||||
when: ansible_distribution == 'Ubuntu' or ansible_distribution_version is version('20.04', '>=')
|
when: ansible_distribution == 'Ubuntu' or ansible_distribution_version is version('20.04', '>=')
|
||||||
|
|
||||||
- name: Add Docker apt key.
|
|
||||||
apt_key:
|
|
||||||
url: "{{ docker_apt_gpg_key }}"
|
|
||||||
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
|
||||||
state: present
|
|
||||||
register: add_repository_key
|
|
||||||
ignore_errors: "{{ docker_apt_ignore_key_error }}"
|
|
||||||
|
|
||||||
- name: Ensure curl is present (on older systems without SNI).
|
- name: Ensure curl is present (on older systems without SNI).
|
||||||
package: name=curl state=present
|
package: name=curl state=present
|
||||||
when: add_repository_key is failed
|
when: add_repository_key is failed
|
||||||
|
|
||||||
- name: Add Docker apt key (alternative for older systems without SNI).
|
- name: Remove gpg keys if they exist #otherwise GPG doesn't run if file already exists
|
||||||
shell: >
|
file:
|
||||||
curl -sSL {{ docker_apt_gpg_key }} | apt-key add -
|
path: "{{ item }}"
|
||||||
args:
|
state: absent
|
||||||
warn: false
|
with_items:
|
||||||
when: add_repository_key is failed
|
- /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
|
- /usr/share/keyrings/docker-archive-keyring.gpg_armored
|
||||||
|
|
||||||
- name: Add Docker repository.
|
- name: Download Docker gpg key
|
||||||
apt_repository:
|
get_url:
|
||||||
repo: "{{ docker_apt_repository }}"
|
url: https://download.docker.com/linux/ubuntu/gpg
|
||||||
state: present
|
dest: /usr/share/keyrings/docker-archive-keyring.gpg_armored
|
||||||
update_cache: true
|
checksum: sha256:1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570 # curl -sL https://download.docker.com/linux/ubuntu/gpg|sha256sum
|
||||||
|
|
||||||
|
- name: De-Armor Docker GPG key
|
||||||
|
shell: gpg --dearmor < /usr/share/keyrings/docker-archive-keyring.gpg_armored > /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
|
args:
|
||||||
|
creates: /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
|
|
||||||
|
- name: "Add Docker's repository to APT sources list"
|
||||||
|
apt_repository:
|
||||||
|
repo: "deb [arch={{ docker_apt_arch }}] signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] {{ docker_repo_url }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}"
|
||||||
|
state: present
|
||||||
|
update_cache: true
|
Loading…
Reference in New Issue
Block a user