Skip to content

Commit

Permalink
Ability to define GPG key path for Docker APT (#10513)
Browse files Browse the repository at this point in the history
  • Loading branch information
emiran-orange authored Oct 13, 2023
1 parent 4a8a47d commit e65050d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,9 @@ Adding extra options to pass to the docker daemon:
## This string should be exactly as you wish it to appear.
docker_options: ""
```

For Debian based distributions, set the path to store the GPG key to avoid using the default one used in `apt_key` module (e.g. /etc/apt/trusted.gpg)

```yaml
docker_repo_key_keyring: /etc/apt/trusted.gpg.d/docker.gpg
```
3 changes: 3 additions & 0 deletions roles/container-engine/docker/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ docker_cli_version: "{{ docker_version }}"
docker_package_info:
pkgs:

# Path where to store repo key
# docker_repo_key_keyring: /etc/apt/trusted.gpg.d/docker.gpg

docker_repo_key_info:
repo_keys:

Expand Down
1 change: 1 addition & 0 deletions roles/container-engine/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
apt_key:
id: "{{ item }}"
url: "{{ docker_repo_key_info.url }}"
keyring: "{{ docker_repo_key_keyring|default(omit) }}"
state: present
register: keyserver_task_result
until: keyserver_task_result is succeeded
Expand Down
1 change: 1 addition & 0 deletions tests/files/packet_debian12-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ mode: default
container_manager: docker
etcd_deployment_type: docker
resolvconf_mode: docker_dns
docker_repo_key_keyring: /etc/apt/trusted.gpg.d/docker.gpg
1 change: 1 addition & 0 deletions tests/files/packet_ubuntu22-aio-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ enable_nodelocaldns: False
container_manager: docker
etcd_deployment_type: docker
resolvconf_mode: docker_dns
docker_repo_key_keyring: /etc/apt/trusted.gpg.d/docker.gpg

0 comments on commit e65050d

Please sign in to comment.