]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
rgw: add ceph-validate tasks for multisite, other fixes
authorAli Maredia <amaredia@redhat.com>
Fri, 26 Oct 2018 14:39:56 +0000 (14:39 +0000)
committerSébastien Han <seb@redhat.com>
Tue, 30 Oct 2018 13:00:28 +0000 (14:00 +0100)
- updated README-MULTISITE
- re-added destroy.yml
- added tasks in ceph-validate to make sure the
rgw multisite vars are set

Signed-off-by: Ali Maredia <amaredia@redhat.com>
README-MULTISITE.md
group_vars/rgws.yml.sample
roles/ceph-rgw/defaults/main.yml
roles/ceph-rgw/tasks/main.yml
roles/ceph-rgw/tasks/multisite/destroy.yml [new file with mode: 0644]
roles/ceph-validate/tasks/check_rgw_multisite.yml [new file with mode: 0644]
roles/ceph-validate/tasks/main.yml

index fa2cfee86095b421b60acfad49b6d53754861311..5b09c130f9b0e686b8e0f09adf7f7630163368ff 100644 (file)
@@ -33,6 +33,7 @@ rgw_multisite: true
 rgw_zone: jupiter
 rgw_zonemaster: true
 rgw_zonesecondary: false
+rgw_multisite_endpoint_addr: "{{ ansible_fqdn }}"
 rgw_zonegroup: solarsystem
 rgw_zone_user: zone.user
 rgw_realm: milkyway
@@ -56,6 +57,7 @@ rgw_multisite: true
 rgw_zone: mars
 rgw_zonemaster: false
 rgw_zonesecondary: true
+rgw_multisite_endpoint_addr: "{{ ansible_fqdn }}"
 rgw_zonegroup: solarsystem
 rgw_zone_user: zone.user
 rgw_realm: milkyway
@@ -66,7 +68,7 @@ rgw_pull_port: 8080
 rgw_pullhost: cluster0-rgw0
 ```
 
-**Note:** pullhost should be the host of the RGW that is configured as the Zone Master
+**Note:** pullhost should be the rgw_multisite_endpoint_addr of the RGW that is configured as the Zone Master
 **Note:** rgw_zone_user, system_access_key, and system_secret_key should match what you used in the master cluster
 **Note:** rgw_zonemaster should have the value of false and rgw_zonesecondary should be true
 
index c94c65d8d3abe26ec3cc62a1de4a36f70c4ef2be..3ab282bb993957048b0e3e53abaa2b539fad8b64 100644 (file)
@@ -63,16 +63,16 @@ dummy:
 #rgw_zonemaster: true
 #rgw_zonesecondary: false
 #rgw_multisite_endpoint_addr: "{{ ansible_fqdn }}"
-#rgw_zonegroup: dummy # should be set by the user
+#rgw_zonegroup: solarsystem # should be set by the user
 #rgw_zone_user: zone.user
-#rgw_realm: dummy # should be set by the user
-#system_access_key: 6kWkikvapSnHyE22P7nO
-#system_secret_key: MGecsMrWtKZgngOHZdrd6d3JxGO5CPWgT2lcnpSt
+#rgw_realm: milkyway # should be set by the user
+#system_access_key: 6kWkikvapSnHyE22P7nO # should be re-created by the user
+#system_secret_key: MGecsMrWtKZgngOHZdrd6d3JxGO5CPWgT2lcnpSt # should be re-created by the user
 
 # Multi-site remote pull URL variables
 #rgw_pull_port: "{{ radosgw_civetweb_port }}"
 #rgw_pull_proto: "http"
-#rgw_pullhost: localhost # rgw_pullhost only needs to be declared if there is a zone secondary
+#rgw_pullhost: localhost # rgw_pullhost only needs to be declared if there is a zone secondary. It should be the same as rgw_multisite_endpoint_addr for the master cluster
 
 ##########
 # DOCKER #
index b4f764c1411ffe5db6feacdc019e93d1dcfaa4a6..f3f099b8d57dee4deade2bcdb80a200bd460df8a 100644 (file)
@@ -55,16 +55,16 @@ rgw_zone: default
 rgw_zonemaster: true
 rgw_zonesecondary: false
 rgw_multisite_endpoint_addr: "{{ ansible_fqdn }}"
-#rgw_zonegroup: dummy # should be set by the user
+#rgw_zonegroup: solarsystem # should be set by the user
 #rgw_zone_user: zone.user
-#rgw_realm: dummy # should be set by the user
-#system_access_key: 6kWkikvapSnHyE22P7nO
-#system_secret_key: MGecsMrWtKZgngOHZdrd6d3JxGO5CPWgT2lcnpSt
+#rgw_realm: milkyway # should be set by the user
+#system_access_key: 6kWkikvapSnHyE22P7nO # should be re-created by the user
+#system_secret_key: MGecsMrWtKZgngOHZdrd6d3JxGO5CPWgT2lcnpSt # should be re-created by the user
 
 # Multi-site remote pull URL variables
 rgw_pull_port: "{{ radosgw_civetweb_port }}"
 rgw_pull_proto: "http"
-#rgw_pullhost: localhost # rgw_pullhost only needs to be declared if there is a zone secondary
+#rgw_pullhost: localhost # rgw_pullhost only needs to be declared if there is a zone secondary. It should be the same as rgw_multisite_endpoint_addr for the master cluster
 
 ##########
 # DOCKER #
index 1f6f705e814f8ab1e6371ba5d7f94aa10176c9e6..56efc208ba65a0524095f2d990d7a3f70fb38d03 100644 (file)
@@ -16,9 +16,7 @@
 
 - name: include_tasks multisite/main.yml
   include_tasks: multisite/main.yml
-  when:
-    - rgw_multisite
-    - ceph_release_num[ceph_release] >= ceph_release_num.jewel
+  when: rgw_multisite
 
 - name: include_tasks docker/main.yml
   include_tasks: docker/main.yml
diff --git a/roles/ceph-rgw/tasks/multisite/destroy.yml b/roles/ceph-rgw/tasks/multisite/destroy.yml
new file mode 100644 (file)
index 0000000..6054e7c
--- /dev/null
@@ -0,0 +1,38 @@
+---
+- name: delete the zone user
+  command: radosgw-admin user rm --uid=zone.user
+  run_once: true
+  failed_when: false
+
+- name: remove zone from zonegroup
+  command: radosgw-admin zonegroup remove --rgw-zonegroup={{ rgw_zonegroup }} --rgw-zone={{ rgw_zone }}
+  run_once: true
+  failed_when: false
+  notify:
+    - update period
+
+- name: delete the zone
+  command: radosgw-admin zone delete --rgw-zonegroup={{ rgw_zonegroup }} --rgw-zone={{ rgw_zone }}
+  run_once: true
+  failed_when: false
+
+- name: delete the zonegroup
+  command: radosgw-admin zonegroup delete --rgw-zonegroup={{ rgw_zonegroup }}
+  run_once: true
+  failed_when: false
+
+- name: delete the realm
+  command: radosgw-admin realm delete --rgw-realm={{ rgw_realm }}
+  run_once: true
+  failed_when: false
+
+- name: delete zone from rgw stanza in ceph.conf
+  lineinfile:
+    dest: "/etc/ceph/{{ cluster }}.conf"
+    regexp: "rgw_zone = {{ rgw_zonegroup }}-{{ rgw_zone }}"
+    state: absent
+  when:
+    - rgw_zone is defined
+    - rgw_zonegroup is defined
+  notify:
+    - restart rgw
diff --git a/roles/ceph-validate/tasks/check_rgw_multisite.yml b/roles/ceph-validate/tasks/check_rgw_multisite.yml
new file mode 100644 (file)
index 0000000..84a6ea6
--- /dev/null
@@ -0,0 +1,68 @@
+---
+- name: fail if rgw_zone is default
+  fail:
+    msg: "rgw_zone cannot be named 'default'"
+  when: rgw_zone == 'default' or rgw_zone is undefined
+
+- name: fail if either rgw_zonemaster or rgw_zonesecondary is undefined
+  fail:
+    msg: "rgw_zonemaster and rgw_zonesecondary must be defined"
+  when: rgw_zonemaster is undefined or rgw_zonesecondary is undefined
+
+- name: fail if rgw_zonemaster and rgw_zonesecondary are both true 
+  fail:
+    msg: "rgw_zonemaster and rgw_zonesecondary cannot both be true"
+  when:
+    - rgw_zonemaster
+    - rgw_zonesecondary
+
+- name: fail if rgw_zonegroup is not set
+  fail:
+    msg: "rgw_zonegroup has not been set by the user"
+  when: rgw_zonegroup is undefined
+
+- name: fail if rgw_zone_user is not set
+  fail:
+    msg: "rgw_zone_user has not been set by the user"
+  when: rgw_zone_user is undefined
+
+- name: fail if rgw_realm is not set
+  fail:
+    msg: "rgw_realm has not been set by the user"
+  when: rgw_realm is undefined
+
+- name: fail if system_access_key is not set
+  fail:
+    msg: "system_access_key has not been set by the user"
+  when: system_access_key is undefined
+
+- name: fail if system_secret_key is not set
+  fail:
+    msg: "system_secret_key has not been set by the user"
+  when: system_secret_key is undefined
+
+- name: fail if rgw_multisite_endpoint_addr is not set
+  fail:
+    msg: "rgw_multisite_endpoint_addr has not been set by the user"
+  when: rgw_multisite_endpoint_addr is undefined
+
+- name: fail if rgw_pull_port is not set
+  fail:
+    msg: "rgw_pull_port has not been set by the user"
+  when:
+    - rgw_zonesecondary
+    - rgw_pull_port is undefined
+
+- name: fail if rgw_pull_proto is not set
+  fail:
+    msg: "rgw_pull_proto has not been set by the user"
+  when:
+    - rgw_zonesecondary
+    - rgw_pull_proto is undefined
+
+- name: fail if rgw_pullhost is not set
+  fail:
+    msg: "rgw_pullhost has not been set by the user"
+  when:
+    - rgw_zonesecondary
+    - rgw_pullhost is undefined
index 7ce8cfd614845cbab2c51417e3e892a24f165148..1847870ed787c978d8b30449c7d27eeaf7e4507f 100644 (file)
     - radosgw_address == "0.0.0.0"
     - radosgw_address_block == "subnet"
 
+- name: include check_rgw_multisite.yml
+  include_tasks: check_rgw_multisite.yml
+  when: 
+    - inventory_hostname in groups.get(rgw_group_name, [])
+    - rgw_multisite
+
 - name: include check_iscsi.yml
   include_tasks: check_iscsi.yml
   when: