2016-08-08 11:16:15 +08:00
|
|
|
---
|
2021-01-15 00:52:39 +08:00
|
|
|
- name: create list secondary_realms
|
|
|
|
set_fact:
|
|
|
|
secondary_realms: "{{ secondary_realms | default([]) | union([{ 'realm': item.rgw_realm, 'zonegroup': item.rgw_zonegroup, 'zone': item.rgw_zone, 'endpoint': item.endpoint, 'system_access_key': item.system_access_key, 'system_secret_key': item.system_secret_key, 'is_master': item.rgw_zonemaster | default(hostvars[item.host]['rgw_zonemaster']) }]) }}"
|
|
|
|
loop: "{{ rgw_instances_all }}"
|
|
|
|
run_once: true
|
|
|
|
when: not item.rgw_zonemaster | default(hostvars[item.host]['rgw_zonemaster']) | bool
|
|
|
|
|
2020-09-17 12:19:45 +08:00
|
|
|
- name: ensure connection to primary cluster from mon
|
|
|
|
uri:
|
|
|
|
url: "{{ item.endpoint }}"
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
run_once: true
|
|
|
|
loop: "{{ secondary_realms }}"
|
|
|
|
when: secondary_realms is defined
|
|
|
|
|
|
|
|
- name: ensure connection to primary cluster from rgw
|
|
|
|
uri:
|
|
|
|
url: "{{ item.endpoint }}"
|
|
|
|
loop: "{{ rgw_instances }}"
|
2021-01-15 00:52:39 +08:00
|
|
|
when: not item.rgw_zonemaster | default(rgw_zonemaster) | bool
|
2020-09-17 12:19:45 +08:00
|
|
|
|
2019-10-05 03:31:25 +08:00
|
|
|
- name: fetch the realm(s)
|
2021-01-26 07:06:03 +08:00
|
|
|
radosgw_realm:
|
|
|
|
name: "{{ item.realm }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
url: "{{ item.endpoint }}"
|
|
|
|
access_key: "{{ item.system_access_key }}"
|
|
|
|
secret_key: "{{ item.system_secret_key }}"
|
|
|
|
state: pull
|
2017-09-19 06:33:23 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2016-08-11 05:05:27 +08:00
|
|
|
run_once: true
|
2020-03-09 18:05:01 +08:00
|
|
|
loop: "{{ secondary_realms }}"
|
2019-10-05 03:31:25 +08:00
|
|
|
when: secondary_realms is defined
|
2021-01-26 07:06:03 +08:00
|
|
|
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 }}"
|
2016-08-11 05:05:27 +08:00
|
|
|
|
2019-10-05 03:31:25 +08:00
|
|
|
- name: get the period(s)
|
|
|
|
command: "{{ container_exec_cmd }} radosgw-admin period get --cluster={{ cluster }} --rgw-realm={{ item.realm }}"
|
2017-09-19 06:33:23 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2016-08-11 05:05:27 +08:00
|
|
|
run_once: true
|
2020-03-09 18:05:01 +08:00
|
|
|
loop: "{{ secondary_realms }}"
|
2019-10-05 03:31:25 +08:00
|
|
|
when: secondary_realms is defined
|
2016-08-08 11:16:15 +08:00
|
|
|
|
2020-08-27 06:53:04 +08:00
|
|
|
- name: create the zone(s)
|
|
|
|
radosgw_zone:
|
|
|
|
name: "{{ item.zone }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
realm: "{{ item.realm }}"
|
|
|
|
zonegroup: "{{ item.zonegroup }}"
|
|
|
|
access_key: "{{ item.system_access_key }}"
|
|
|
|
secret_key: "{{ item.system_secret_key }}"
|
|
|
|
default: "{{ true if zones | length == 1 else false }}"
|
|
|
|
master: false
|
2017-09-19 06:33:23 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2016-08-08 11:16:15 +08:00
|
|
|
run_once: true
|
2020-08-27 06:53:04 +08:00
|
|
|
loop: "{{ zones }}"
|
2019-10-05 03:31:25 +08:00
|
|
|
when:
|
|
|
|
- zones is defined
|
2020-08-27 06:53:04 +08:00
|
|
|
- not item.is_master | bool
|
|
|
|
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 }}"
|
2016-08-08 11:16:15 +08:00
|
|
|
|
2019-10-05 03:31:25 +08:00
|
|
|
- name: add endpoints to their zone(s)
|
2020-08-27 06:53:04 +08:00
|
|
|
radosgw_zone:
|
|
|
|
name: "{{ item.zone }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
realm: "{{ item.realm }}"
|
|
|
|
zonegroup: "{{ item.zonegroup }}"
|
|
|
|
endpoints: "{{ item.endpoints.split(',') }}"
|
2017-09-19 06:33:23 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2016-08-08 11:16:15 +08:00
|
|
|
run_once: true
|
2020-08-27 06:53:04 +08:00
|
|
|
loop: "{{ zone_endpoints_list }}"
|
2019-10-05 03:31:25 +08:00
|
|
|
when:
|
|
|
|
- zone_endpoints_list is defined
|
|
|
|
- not item.is_master | bool
|
2020-08-27 06:53:04 +08:00
|
|
|
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 }}"
|
2019-02-01 04:43:21 +08:00
|
|
|
|
2019-10-05 03:31:25 +08:00
|
|
|
- name: update period for zone creation
|
|
|
|
command: "{{ container_exec_cmd }} radosgw-admin --cluster={{ cluster }} --rgw-realm={{ item.realm }} --rgw-zonegroup={{ item.zonegroup }} --rgw-zone={{ item.zone }} period update --commit"
|
2019-02-01 04:43:21 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
run_once: true
|
2020-03-09 18:05:01 +08:00
|
|
|
loop: "{{ zone_endpoints_list }}"
|
2019-10-05 03:31:25 +08:00
|
|
|
when:
|
|
|
|
- zone_endpoints_list is defined
|
|
|
|
- not item.is_master | bool
|