--- - name: create the realm(s) command: "{{ container_exec_cmd }} radosgw-admin realm create --cluster={{ cluster }} --rgw-realm={{ item.item }} {{ '--default' if realms | length == 1 else '' }}" delegate_to: "{{ groups[mon_group_name][0] }}" run_once: true loop: "{{ realmcheck.results }}" when: - realms is defined - realms | length > 0 - "'No such file or directory' in item.stderr" - name: create zonegroup(s) command: "{{ container_exec_cmd }} radosgw-admin zonegroup create --cluster={{ cluster }} --rgw-realm={{ item.item.realm }} --rgw-zonegroup={{ item.item.zonegroup }} {{ '--default' if zonegroups | length == 1 else '' }} {{ '--master' if item.item.is_master | bool else '' }}" delegate_to: "{{ groups[mon_group_name][0] }}" run_once: true loop: "{{ zonegroupcheck.results }}" when: - zonegroups is defined - zonegroups | length > 0 - item.item.is_master | bool - "'No such file or directory' in item.stderr" - name: create the master zone command: "{{ container_exec_cmd }} radosgw-admin zone create --cluster={{ cluster }} --rgw-realm={{ item.item.realm }} --rgw-zonegroup={{ item.item.zonegroup }} --rgw-zone={{ item.item.zone }} --access-key={{ item.item.system_access_key }} --secret={{ item.item.system_secret_key }} {{ '--default' if zones | length == 1 else '' }} --master" delegate_to: "{{ groups[mon_group_name][0] }}" run_once: true loop: "{{ zonecheck.results }}" when: - zones is defined - zones | length > 0 - item.item.is_master | bool - "'No such file or directory' in item.stderr" - name: add endpoints to their zone(s) command: "{{ container_exec_cmd }} radosgw-admin zone modify --cluster={{ cluster }} --rgw-realm={{ item.realm }} --rgw-zonegroup={{ item.zonegroup }} --rgw-zone={{ item.zone }} --endpoints {{ item.endpoints }}" loop: "{{ zone_endpoints_list }}" delegate_to: "{{ groups[mon_group_name][0] }}" run_once: true when: - zone_endpoints_list is defined - item.is_master | bool - 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" delegate_to: "{{ groups[mon_group_name][0] }}" run_once: true loop: "{{ zone_endpoints_list }}" when: - zone_endpoints_list is defined - item.is_master | bool - name: include_tasks create_zone_user.yml include_tasks: create_zone_user.yml