From 402a597fe6d06aa83d82e8751263e82e8fb80d23 Mon Sep 17 00:00:00 2001 From: James Saint-Rossy Date: Sun, 7 Aug 2016 23:16:15 -0400 Subject: [PATCH] Added initial multisite support --- roles/ceph-rgw/handlers/main.yml | 3 ++ roles/ceph-rgw/handlers/multisite.yml | 3 ++ roles/ceph-rgw/tasks/main.yml | 3 ++ roles/ceph-rgw/tasks/multisite.yml | 52 +++++++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 roles/ceph-rgw/handlers/main.yml create mode 100644 roles/ceph-rgw/handlers/multisite.yml create mode 100644 roles/ceph-rgw/tasks/multisite.yml diff --git a/roles/ceph-rgw/handlers/main.yml b/roles/ceph-rgw/handlers/main.yml new file mode 100644 index 000000000..a448e19bd --- /dev/null +++ b/roles/ceph-rgw/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- include: multisite.yml + when: rgw_zone is defined and rgw_multisite and ( is_jewel or is_after_jewel ) diff --git a/roles/ceph-rgw/handlers/multisite.yml b/roles/ceph-rgw/handlers/multisite.yml new file mode 100644 index 000000000..ccb822659 --- /dev/null +++ b/roles/ceph-rgw/handlers/multisite.yml @@ -0,0 +1,3 @@ +--- +- name: update period + command: radosgw-admin period update --commit diff --git a/roles/ceph-rgw/tasks/main.yml b/roles/ceph-rgw/tasks/main.yml index 91c8c9f79..f79ee73aa 100644 --- a/roles/ceph-rgw/tasks/main.yml +++ b/roles/ceph-rgw/tasks/main.yml @@ -5,6 +5,9 @@ - include: openstack-keystone.yml when: radosgw_keystone +- include: multisite.yml + when: rgw_zone is defined and rgw_multisite and ( is_jewel or is_after_jewel ) + - include: start_radosgw.yml when: not rgw_containerized_deployment diff --git a/roles/ceph-rgw/tasks/multisite.yml b/roles/ceph-rgw/tasks/multisite.yml new file mode 100644 index 000000000..d4afe069e --- /dev/null +++ b/roles/ceph-rgw/tasks/multisite.yml @@ -0,0 +1,52 @@ +--- +- name: Check if the realm already exists + command: radosgw-admin realm get --rgw-realm={{ rgw_realm }} + register: realmcheck + failed_when: False + changed_when: False + +- name: Create the realm + command: radosgw-admin realm create --rgw-realm={{ rgw_realm }} --default + run_once: true + when: ('No such file or directory' in realmcheck.stderr) + notify: + - update period + +- name: Check if the zonegroup already exists + command: radosgw-admin zonegroup get --rgw-zonegroup={{ rgw_zonegroup }} + register: zonegroupcheck + failed_when: False + changed_when: False + +- name: Create the zonegroup + command: radosgw-admin zonegroup create --rgw-zonegroup={{ rgw_zonegroup }} --endpoints=http://{{ ansible_hostname }}:8080 --master --default + run_once: true + when: ('No such file or directory' in zonegroupcheck.stderr) and rgw_zonemaster + notify: + - update period + +- name: Check if the zone already exists + command: radosgw-admin zone get --rgw-zone={{ rgw_zone }} + register: zonecheck + failed_when: False + changed_when: False + +- name: Create the zone + command: radosgw-admin zone create --rgw-zonegroup={{ rgw_zonegroup }} --rgw-zone={{ rgw_zone }} --endpoints=http://{{ ansible_hostname }}:8080 --access-key={{ system_access_key }} --secret={{ system_secret_key }} --default --master + run_once: true + when: ('No such file or directory' in zonecheck.stderr) and rgw_zonemaster + notify: + - update period + +- name: Check if the system user already exists + command: radosgw-admin user info --uid=zone.user + register: usercheck + failed_when: False + changed_when: False + +- name: Create the zone user + command: radosgw-admin user create --uid=zone.user --display-name="Zone User" --access-key={{ system_access_key }} --secret={{ system_secret_key }} --system + run_once: true + when: "'could not fetch user info: no user info saved' in usercheck.stderr" + notify: + - update period