From: Ali Maredia Date: Fri, 26 Oct 2018 14:39:56 +0000 (+0000) Subject: rgw: add ceph-validate tasks for multisite, other fixes X-Git-Tag: v3.2.0rc1~7 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=59e6d04f9b70accb5e9b0f5a84e865fb6ea765d3;p=ceph-ansible.git rgw: add ceph-validate tasks for multisite, other fixes - 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 --- diff --git a/README-MULTISITE.md b/README-MULTISITE.md index fa2cfee86..5b09c130f 100644 --- a/README-MULTISITE.md +++ b/README-MULTISITE.md @@ -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 diff --git a/group_vars/rgws.yml.sample b/group_vars/rgws.yml.sample index c94c65d8d..3ab282bb9 100644 --- a/group_vars/rgws.yml.sample +++ b/group_vars/rgws.yml.sample @@ -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 # diff --git a/roles/ceph-rgw/defaults/main.yml b/roles/ceph-rgw/defaults/main.yml index b4f764c14..f3f099b8d 100644 --- a/roles/ceph-rgw/defaults/main.yml +++ b/roles/ceph-rgw/defaults/main.yml @@ -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 # diff --git a/roles/ceph-rgw/tasks/main.yml b/roles/ceph-rgw/tasks/main.yml index 1f6f705e8..56efc208b 100644 --- a/roles/ceph-rgw/tasks/main.yml +++ b/roles/ceph-rgw/tasks/main.yml @@ -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 index 000000000..6054e7c0f --- /dev/null +++ b/roles/ceph-rgw/tasks/multisite/destroy.yml @@ -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 index 000000000..84a6ea677 --- /dev/null +++ b/roles/ceph-validate/tasks/check_rgw_multisite.yml @@ -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 diff --git a/roles/ceph-validate/tasks/main.yml b/roles/ceph-validate/tasks/main.yml index 7ce8cfd61..1847870ed 100644 --- a/roles/ceph-validate/tasks/main.yml +++ b/roles/ceph-validate/tasks/main.yml @@ -69,6 +69,12 @@ - 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: