Skip to content

Commit

Permalink
ceph-dashboard: fix oject gateway integration
Browse files Browse the repository at this point in the history
Since [1] multiple ceph dashboard commands have been removed and this is
breaking the current ceph-ansible dashboard with RGW automation.
This removes the following dashboard rgw commands:

- ceph dashboard set-rgw-api-access-key
- ceph dashboard set-rgw-api-secret-key
- ceph dashboard set-rgw-api-host
- ceph dashboard set-rgw-api-port
- ceph dashboard set-rgw-api-scheme

Which are replaced by `ceph dashboard set-rgw-credentials`

The RGW user creation task is also removed.

Finally moving the delegate_to statement from the rgw tasks at the block
level.

[1] ceph/ceph#42252

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 2ee2194)
  • Loading branch information
dsavineau authored and guits committed Sep 18, 2021
1 parent cb5a675 commit 9424200
Showing 1 changed file with 52 additions and 54 deletions.
106 changes: 52 additions & 54 deletions roles/ceph-dashboard/tasks/configure_dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,70 +253,68 @@
- name: dashboard object gateway management frontend
when: groups.get(rgw_group_name, []) | length > 0
run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}"
block:
- name: create radosgw system user
radosgw_user:
name: "{{ dashboard_rgw_api_user_id }}"
cluster: "{{ cluster }}"
display_name: "Ceph dashboard"
system: true
delegate_to: "{{ groups[mon_group_name][0] }}"
register: rgw_dashboard_user
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"

- name: get the rgw access and secret keys
set_fact:
rgw_access_key: "{{ (rgw_dashboard_user.stdout | from_json)['keys'][0]['access_key'] }}"
rgw_secret_key: "{{ (rgw_dashboard_user.stdout | from_json)['keys'][0]['secret_key'] }}"

- name: set the rgw user
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-user-id {{ dashboard_rgw_api_user_id }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false

- name: set the rgw access key
command: "{{ ceph_cmd }} --cluster {{ cluster }} dashboard set-rgw-api-access-key -i -"
args:
stdin: "{{ rgw_access_key }}"
stdin_add_newline: no
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false

- name: set the rgw secret key
command: "{{ ceph_cmd }} --cluster {{ cluster }} dashboard set-rgw-api-secret-key -i -"
args:
stdin: "{{ rgw_secret_key }}"
stdin_add_newline: no
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false

- name: set the rgw host
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-host {{ hostvars[groups[rgw_group_name][0]]['rgw_instances'][0]['radosgw_address'] }}"
changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}"

- name: set the rgw port
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-port {{ hostvars[groups[rgw_group_name][0]]['rgw_instances'][0]['radosgw_frontend_port'] }}"
changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}"

- name: set the rgw scheme
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-scheme {{ 'https' if radosgw_frontend_ssl_certificate else 'http' }}"
changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}"
- name: setup rgw credentials backward
block:
- name: set the rgw credentials
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-credentials"
changed_when: false
rescue:
- name: create radosgw system user
radosgw_user:
name: "{{ dashboard_rgw_api_user_id }}"
cluster: "{{ cluster }}"
display_name: "Ceph dashboard"
system: true
register: rgw_dashboard_user
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"

- name: get the rgw access and secret keys
set_fact:
rgw_access_key: "{{ (rgw_dashboard_user.stdout | from_json)['keys'][0]['access_key'] }}"
rgw_secret_key: "{{ (rgw_dashboard_user.stdout | from_json)['keys'][0]['secret_key'] }}"

- name: set the rgw user
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-user-id {{ dashboard_rgw_api_user_id }}"
changed_when: false

- name: set the rgw access key
command: "{{ ceph_cmd }} --cluster {{ cluster }} dashboard set-rgw-api-access-key -i -"
args:
stdin: "{{ rgw_access_key }}"
stdin_add_newline: no
changed_when: false

- name: set the rgw secret key
command: "{{ ceph_cmd }} --cluster {{ cluster }} dashboard set-rgw-api-secret-key -i -"
args:
stdin: "{{ rgw_secret_key }}"
stdin_add_newline: no
delegate_to: "{{ groups[mon_group_name][0] }}"

- name: set the rgw host
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-host {{ hostvars[groups[rgw_group_name][0]]['rgw_instances'][0]['radosgw_address'] }}"
changed_when: false

- name: set the rgw port
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-port {{ hostvars[groups[rgw_group_name][0]]['rgw_instances'][0]['radosgw_frontend_port'] }}"
changed_when: false

- name: set the rgw scheme
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-scheme {{ 'https' if radosgw_frontend_ssl_certificate else 'http' }}"
changed_when: false

- name: set the rgw admin resource
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-admin-resource {{ dashboard_rgw_api_admin_resource }}"
changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}"
when: dashboard_rgw_api_admin_resource | length > 0

- name: disable ssl verification for rgw
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-ssl-verify False"
changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}"
when:
- dashboard_rgw_api_no_ssl_verify | bool
- radosgw_frontend_ssl_certificate | length > 0
Expand Down

0 comments on commit 9424200

Please sign in to comment.