mirror of
https://github.com/Maks1mS/ansible-role-docker.git
synced 2024-12-24 00:33:04 +03:00
434 Add GPG keys to keyrings instead of trusted.gpg.d
This commit is contained in:
parent
8ff4a24147
commit
1dca07177f
@ -38,7 +38,7 @@ docker_apt_release_channel: stable
|
|||||||
# and is only necessary until Docker officially supports them.
|
# 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_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_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
|
||||||
docker_apt_repository: "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 }}"
|
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_ignore_key_error: true
|
docker_apt_ignore_key_error: true
|
||||||
docker_apt_gpg_key: "{{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }}/gpg"
|
docker_apt_gpg_key: "{{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }}/gpg"
|
||||||
docker_apt_gpg_key_checksum: "sha256:1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570"
|
docker_apt_gpg_key_checksum: "sha256:1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570"
|
||||||
|
@ -27,25 +27,23 @@
|
|||||||
state: present
|
state: present
|
||||||
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('20.04', '>=')
|
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('20.04', '>=')
|
||||||
|
|
||||||
- name: Add Docker apt key.
|
- name: Ensure directory exists for /etc/apt/keyrings
|
||||||
ansible.builtin.get_url:
|
file:
|
||||||
url: "{{ docker_apt_gpg_key }}"
|
path: /etc/apt/keyrings
|
||||||
dest: /etc/apt/trusted.gpg.d/docker.asc
|
state: directory
|
||||||
mode: '0644'
|
mode: '0755'
|
||||||
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: Ensure curl is present (on older systems without SNI).
|
- name: Ensure curl is present
|
||||||
package: name=curl state=present
|
package: name=curl state=present
|
||||||
when: add_repository_key is failed and docker_add_repo | bool
|
|
||||||
|
|
||||||
- name: Add Docker apt key (alternative for older systems without SNI).
|
- name: Add Docker apt key
|
||||||
shell: >
|
shell: >
|
||||||
curl -sSL {{ docker_apt_gpg_key }} | apt-key add -
|
curl -sSL {{ docker_apt_gpg_key }} | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg --yes
|
||||||
when: add_repository_key is failed and docker_add_repo | bool
|
|
||||||
|
- name: Change permissions for /etc/apt/keyrings/docker.gpg
|
||||||
|
file:
|
||||||
|
path: /etc/apt/keyrings/docker.gpg
|
||||||
|
mode: 'a+r'
|
||||||
|
|
||||||
- name: Add Docker repository.
|
- name: Add Docker repository.
|
||||||
apt_repository:
|
apt_repository:
|
||||||
|
Loading…
Reference in New Issue
Block a user