Skip to content

Commit 78a7e21

Browse files
committed
Fix ceph 9 RGW deployment
rgw_frontend_ssl_certificate has been deprecated in ceph8 and in ceph9 doesn't work properly anymore. There's a new way of setting both cert and key when ssl is used and is fully documented in [1]. This patch still preserves the old way of deploying rgw through a new var used to execute the old code. When "rgw_ssl_backward_compatibility" is set, the old facts are set, resulting in populating the old variables, otherwise the new method based on ssl_cert and ssl_key is applied. [1] https://docs.ceph.com/en/latest/cephadm/services/rgw/ Signed-off-by: Francesco Pantano <[email protected]>
1 parent 662c0ca commit 78a7e21

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

roles/cifmw_cephadm/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,4 @@ cifmw_cephadm_wait_install_retries: 8
153153
cifmw_cephadm_wait_install_delay: 15
154154
cifmw_cephadm_rgw_ingress_service_name: "ingress.rgw.default"
155155
cifmw_cephadm_rgw_ingress_service_id: "rgw.default"
156+
cifmw_rgw_ssl_backward_compatibility: true

roles/cifmw_cephadm/tasks/rgw.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@
5656
ansible.builtin.slurp:
5757
src: "{{ cifmw_cephadm_key }}"
5858

59-
- name: Set rgw_frontend_cert to cert/key concatenation
59+
- name: Set SSL cert/key variables based on rgw_compatibility mode
6060
ansible.builtin.set_fact:
61-
rgw_frontend_cert: "{{ slurp_cert['content'] | b64decode ~
62-
slurp_key['content'] | b64decode }}"
61+
rgw_frontend_cert: "{{ (slurp_cert['content'] | b64decode ~ slurp_key['content'] | b64decode) if cifmw_rgw_ssl_backward_compatibility else omit }}"
62+
rgw_ssl_cert: "{{ slurp_cert['content'] | b64decode if not cifmw_rgw_ssl_backward_compatibility else omit }}"
63+
rgw_ssl_key: "{{ slurp_key['content'] | b64decode if not cifmw_rgw_ssl_backward_compatibility else omit }}"
6364

6465
- name: Create a Ceph RGW spec
6566
ansible.builtin.template:

roles/cifmw_cephadm/templates/ceph_rgw.yml.j2

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,19 @@ networks:
1111
- {{ cifmw_cephadm_rgw_network }}
1212
spec:
1313
rgw_frontend_port: 8082
14-
{% if rgw_frontend_cert is defined %}
14+
{% if rgw_frontend_cert is defined and cifmw_rgw_ssl_backward_compatibility %}
1515
ssl: true
1616
rgw_frontend_ssl_certificate: |
1717
{{ rgw_frontend_cert | indent( width=4 ) }}
1818
{% endif %}
19+
{% if rgw_ssl_cert is defined %}
20+
ssl: true
21+
certificate_source: inline
22+
ssl_cert: |-
23+
{{ rgw_ssl_cert | indent( width=4 ) }}
24+
ssl_key: |-
25+
{{ rgw_ssl_key | indent( width=4 ) }}
26+
{% endif %}
1927
---
2028
{% if _hosts|length > 1 %}
2129
service_type: ingress
@@ -28,8 +36,15 @@ spec:
2836
virtual_interface_networks:
2937
- {{ cifmw_cephadm_rgw_network }}
3038
virtual_ip: {{ cifmw_cephadm_rgw_vip }}/{{ cidr }}
31-
{% if rgw_frontend_cert is defined %}
39+
{% if rgw_frontend_cert is defined and cifmw_rgw_ssl_backward_compatibility %}
3240
ssl_cert: |
3341
{{ rgw_frontend_cert | indent( width=6 ) }}
3442
{% endif %}
43+
{% if rgw_ssl_cert is defined %}
44+
ssl: true
45+
ssl_cert: |-
46+
{{ rgw_ssl_cert | indent( width=6 ) }}
47+
ssl_key: |-
48+
{{ rgw_ssl_key | indent( width=6 ) }}
49+
{% endif %}
3550
{% endif %}

0 commit comments

Comments
 (0)