ceph-ansible/roles/ceph-rgw/tasks/multisite/main.yml

54 lines
2.6 KiB
YAML

---
- name: set_fact realms
set_fact:
realms: '{{ realms | default([]) | union([item.rgw_realm]) }}'
run_once: true
loop: "{{ rgw_instances_all }}"
when: item.rgw_zonemaster | default(hostvars[item.host]['rgw_zonemaster']) | bool
- name: create list zonegroups
set_fact:
zonegroups: "{{ zonegroups | default([]) | union([{ 'realm': item.rgw_realm, 'zonegroup': item.rgw_zonegroup, 'is_master': item.rgw_zonegroupmaster | default(hostvars[item.host]['rgw_zonegroupmaster']) }]) }}"
run_once: true
loop: "{{ rgw_instances_all }}"
when: item.rgw_zonegroupmaster | default(hostvars[item.host]['rgw_zonegroupmaster']) | bool
- name: create list zones
set_fact:
zones: "{{ zones | default([]) | union([{ 'realm': item.rgw_realm, 'zonegroup': item.rgw_zonegroup, 'zone': item.rgw_zone, 'is_master': item.rgw_zonemaster | default(hostvars[item.host]['rgw_zonemaster']), 'system_access_key': item.system_access_key, 'system_secret_key': item.system_secret_key }]) }}"
run_once: true
loop: "{{ rgw_instances_all }}"
- name: create a list of dicts with each rgw endpoint and it's zone
set_fact:
zone_endpoint_pairs: "{{ zone_endpoint_pairs | default([]) | union([{ 'endpoint': hostvars[item.host]['rgw_multisite_proto'] + '://' + item.radosgw_address + ':' + item.radosgw_frontend_port | string, 'rgw_zone': item.rgw_zone, 'rgw_realm': item.rgw_realm, 'rgw_zonegroup': item.rgw_zonegroup, 'rgw_zonemaster': item.rgw_zonemaster | default(hostvars[item.host]['rgw_zonemaster']) }]) }}"
loop: "{{ rgw_instances_all }}"
run_once: true
- name: create a list of zones and all their endpoints
set_fact:
zone_endpoints_list: "{{ zone_endpoints_list | default([]) | union([{'zone': item.rgw_zone, 'zonegroup': item.rgw_zonegroup, 'realm': item.rgw_realm, 'is_master': item.rgw_zonemaster, 'endpoints': ','.join(zone_endpoint_pairs | selectattr('rgw_zone','match','^'+item.rgw_zone+'$') | selectattr('rgw_realm','match','^'+item.rgw_realm+'$') | selectattr('rgw_zonegroup', 'match','^'+item.rgw_zonegroup+'$') | map(attribute='endpoint'))}]) }}"
loop: "{{ zone_endpoint_pairs }}"
run_once: true
- name: include multisite checks
include_tasks: checks.yml
# Include the tasks depending on the zone type
- name: include_tasks master.yml
include_tasks: master.yml
- name: include_tasks secondary.yml
include_tasks: secondary.yml
when: deploy_secondary_zones | default(True) | bool
- name: include_tasks start_radosgw.yml
include_tasks: ../start_radosgw.yml
when:
- not containerized_deployment | bool
- name: include_tasks start_docker_rgw.yml
include_tasks: ../start_docker_rgw.yml
when:
- containerized_deployment | bool