Skip to content

Commit 3123b52

Browse files
fmountevallesp
authored andcommitted
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 ff8eb72 commit 3123b52

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

roles/cifmw_cephadm/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ that they do not need to be changed for a typical EDPM deployment.
103103
* `cifmw_cephadm_config_key_set_ssl_option`: Optional colon separated
104104
list of SSL context options (default: `no_sslv2:sslv3:no_tlsv1:no_tlsv1_1`)
105105

106+
* `cifmw_rgw_ssl_backward_compatibility`: This option is true by default
107+
because this role is able to manage older Ceph releases (starting from
108+
Squid). Set it to false if the target Ceph release is equal to or greater
109+
than Tentacle.
110+
106111
Use the `cifmw_cephadm_pools` list of dictionaries to define pools for
107112
Nova (vms), Cinder (volumes), Cinder-backups (backups), and Glance (images).
108113
```

roles/cifmw_cephadm/defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,6 @@ 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+
# set ssl_backward compatibily to False if ceph version is equal or greater
157+
# than Tentacle
158+
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)