]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
rgw: don't create user on secondary zones
authorDimitri Savineau <dsavinea@redhat.com>
Tue, 5 Nov 2019 16:32:06 +0000 (11:32 -0500)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 17 Feb 2020 15:43:56 +0000 (16:43 +0100)
The rgw user creation for the Ceph dashboard integration shouldn't be
created on secondary rgw zones.

Closes: #4707
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1794351
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 16e12bf2bbf645d78063ba7d0b7a89b2348e56d1)

roles/ceph-dashboard/tasks/configure_dashboard.yml

index 1804c1e56d4d6f7c920037c34d78cee4ea25f905..113d1aa245498c09bfab99d67c2246d1a34f3adb 100644 (file)
   block:
     - name: create radosgw system user
       command: "timeout --foreground -s KILL 20 {{ container_exec_cmd }} radosgw-admin --cluster {{ cluster }} user create --uid={{ dashboard_rgw_api_user_id }} --display-name='Ceph dashboard' --system"
-      register: rgw_user_output
-      until: rgw_user_output.rc == 0
+      register: create_rgw_user
+      until: create_rgw_user.rc == 0
       retries: 3
       delegate_to: "{{ groups[mon_group_name][0] }}"
       run_once: true
+      when: not rgw_multisite | bool or rgw_zonemaster | bool
+
+    - name: get radosgw system user
+      command: "timeout --foreground -s KILL 20 {{ container_exec_cmd }} radosgw-admin --cluster {{ cluster }} user info --uid={{ dashboard_rgw_api_user_id }}"
+      register: get_rgw_user
+      until: get_rgw_user.rc == 0
+      retries: 3
+      when:
+        - rgw_multisite | bool
+        - not rgw_zonemaster | bool
+        - rgw_zonesecondary | bool
 
     - name: get the rgw access and secret keys
       set_fact:
-        rgw_access_key: "{{ (rgw_user_output.stdout | from_json)['keys'][0]['access_key'] }}"
-        rgw_secret_key: "{{ (rgw_user_output.stdout | from_json)['keys'][0]['secret_key'] }}"
+        rgw_access_key: "{{ (create_rgw_user.stdout | default(get_rgw_user.stdout) | from_json)['keys'][0]['access_key'] }}"
+        rgw_secret_key: "{{ (create_rgw_user.stdout | default(get_rgw_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 }}"