Skip to content

Commit 78ff299

Browse files
committed
Stop using apt-key
1. it is deprecated 2. it does not currently work with a proxy, and I could not get it to work by adding --keyserver-options http-proxy=<proxy> Instead of apt-key, we use a more secure approach of downloading the key to a directory, and marking the repository as being signed-by that key. The get_url module will automatically use any proxy configuration in the environment.
1 parent 597fbb6 commit 78ff299

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

roles/cephadm/tasks/pkg_debian.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
---
2-
- name: Add Ceph signing keys
3-
apt_key:
4-
keyserver: keyserver.ubuntu.com
5-
id: E84AC2C0460F3994
2+
- name: Ensure keys directory exists
3+
file:
4+
path: "{{ cephadm_apt_key_path | dirname }}"
5+
owner: root
6+
group: root
7+
mode: 0755
8+
state: directory
9+
when: not cephadm_custom_repos | bool
10+
become: true
11+
12+
- name: Ensure keys exist
13+
get_url:
14+
url: "{{ cephadm_apt_key_url }}"
15+
dest: "{{ cephadm_apt_key_path }}"
16+
owner: root
17+
group: root
18+
mode: 0644
19+
when: not cephadm_custom_repos | bool
620
become: true
721

822
- name: Ensure Ceph repositories are defined
923
apt_repository:
10-
repo: "deb https://download.ceph.com/debian-{{ item }}/ {{ cephadm_apt_repo_dist }} main"
24+
repo: "deb [signed-by={{ cephadm_apt_key_path }}] https://download.ceph.com/debian-{{ item }}/ {{ cephadm_apt_repo_dist }} main"
1125
state: "{{ 'present' if item == cephadm_ceph_release else 'absent' }}"
1226
when: not cephadm_custom_repos | bool
1327
become: true

roles/cephadm/vars/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ cephadm_rpm_repos:
55
cephadm_ceph_releases:
66
- "octopus"
77
- "pacific"
8+
cephadm_apt_key_url: "https://download.ceph.com/keys/release.asc"
9+
cephadm_apt_key_path: "/usr/local/share/keyrings/ceph.asc"

0 commit comments

Comments
 (0)