adopt: import rgw ssl certificate into kv store

Without this, when rgw is managed by cephadm, it fails to start because
the ssl certificate isn't present in the kv store.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1987010
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1988404

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
Co-authored-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 930fc4c850)
(cherry picked from commit 6e9cf80747)
pull/6955/head
Guillaume Abrioux 2021-07-28 21:50:15 +02:00
parent 4ab40842df
commit c9582945fa
1 changed files with 54 additions and 40 deletions

View File

@ -716,8 +716,8 @@
path: "/var/lib/ceph/mds/{{ cluster }}-{{ ansible_facts['hostname'] }}" path: "/var/lib/ceph/mds/{{ cluster }}-{{ ansible_facts['hostname'] }}"
state: absent state: absent
- name: rgw realm/zonegroup/zone requirements - name: redeploy rgw daemons
hosts: "{{ rgw_group_name|default('rgws') }}" hosts: "{{ rgw_group_name | default('rgws') }}"
become: true become: true
gather_facts: false gather_facts: false
any_errors_fatal: True any_errors_fatal: True
@ -729,53 +729,67 @@
name: ceph-facts name: ceph-facts
tasks_from: set_radosgw_address.yml tasks_from: set_radosgw_address.yml
- name: for non multisite setup - name: import rgw ssl certificate into kv store
when: not rgw_multisite | bool when: radosgw_frontend_ssl_certificate | length > 0
run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}"
block: block:
- name: create a default realm - name: slurp rgw ssl certificate
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- radosgw-admin --cluster {{ cluster }} realm create --rgw-realm=default --default" slurp:
run_once: true src: "{{ radosgw_frontend_ssl_certificate }}"
changed_when: false register: rgw_ssl_cert
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: modify the default zonegroup - name: store ssl certificate in kv store (not multisite)
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- radosgw-admin --cluster {{ cluster }} zonegroup modify --rgw-realm=default --rgw-zonegroup=default" command: >
run_once: true {{ container_binary }} run --rm -i -v /etc/ceph:/etc/ceph:z --entrypoint=ceph {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} --cluster {{ cluster }}
changed_when: false config-key set rgw/cert/rgw.{{ ansible_facts['hostname'] }} -i -
environment: args:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' stdin: "{{ rgw_ssl_cert.content | b64decode }}"
stdin_add_newline: no
- name: modify the default zone
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- radosgw-admin --cluster {{ cluster }} zone modify --rgw-realm=default --rgw-zonegroup=default --rgw-zone=default"
run_once: true
changed_when: false
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: commit the period
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- radosgw-admin --cluster {{ cluster }} period update --commit"
run_once: true
changed_when: false
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: update the placement of radosgw hosts
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} orch apply rgw {{ rgw_realm | default('default') }} {{ rgw_zone | default('default') }} --placement='{{ groups.get(rgw_group_name, []) | length }} label:{{ rgw_group_name }}' --port={{ radosgw_frontend_port }} {{ '--ssl' if radosgw_frontend_ssl_certificate else '' }}"
run_once: true
changed_when: false changed_when: false
when: not rgw_multisite | bool
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
environment: environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: update the placement of radosgw multisite hosts - name: store ssl certificate in kv store (multisite)
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} orch apply rgw {{ item.host }}.{{ item.rgw_realm }}.{{ item.rgw_zone }}.{{ item.radosgw_frontend_port }} --realm={{ item.rgw_realm }} --zone={{ item.rgw_zone }} --port={{ item.radosgw_frontend_port }} --placement={{ item.host }}" command: >
{{ container_binary }} run --rm -i -v /etc/ceph:/etc/ceph:z --entrypoint=ceph {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} --cluster {{ cluster }}
config-key set rgw/cert/rgw.{{ ansible_facts['hostname'] }}.{{ item.rgw_realm }}.{{ item.rgw_zone }}.{{ item.radosgw_frontend_port }} -i -
args:
stdin: "{{ rgw_ssl_cert.content | b64decode }}"
stdin_add_newline: no
changed_when: false
loop: "{{ rgw_instances }}"
when: rgw_multisite | bool
delegate_to: "{{ groups[mon_group_name][0] }}"
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: update the placement of radosgw hosts
command: >
{{ cephadm_cmd }} shell --fsid {{ fsid }} --
ceph --cluster {{ cluster }} orch apply rgw
{{ rgw_realm | default('default') }}
{{ rgw_zone | default('default') }}
--placement='{{ groups.get(rgw_group_name, []) | length }} label:{{ rgw_group_name }}'
--port={{ radosgw_frontend_port }}
{{ '--ssl' if radosgw_frontend_ssl_certificate else '' }}
changed_when: false changed_when: false
with_items: "{{ rgw_instances_all }}" delegate_to: "{{ groups[mon_group_name][0] }}"
when: not rgw_multisite | bool
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: update the placement of radosgw multisite hosts
command: >
{{ cephadm_cmd }} shell --fsid {{ fsid }} --
ceph --cluster {{ cluster }} orch apply rgw {{ ansible_facts['hostname'] }}.{{ item.rgw_realm }}.{{ item.rgw_zone }}.{{ item.radosgw_frontend_port }}
--placement={{ ansible_facts['hostname'] }}
--realm={{ item.rgw_realm }} --zone={{ item.rgw_zone }}
--port={{ item.radosgw_frontend_port }}
{{ '--ssl' if radosgw_frontend_ssl_certificate else '' }}
changed_when: false
loop: "{{ rgw_instances }}"
when: rgw_multisite | bool when: rgw_multisite | bool
run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
environment: environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'