2020-03-09 18:05:01 +08:00
|
|
|
---
|
|
|
|
- name: create list zone_users
|
|
|
|
set_fact:
|
|
|
|
zone_users: "{{ zone_users | default([]) | union([{ 'realm': item.rgw_realm, 'zonegroup': item.rgw_zonegroup, 'zone': item.rgw_zone, 'system_access_key': item.system_access_key, 'system_secret_key': item.system_secret_key, 'user': item.rgw_zone_user, 'display_name': item.rgw_zone_user_display_name }]) }}"
|
|
|
|
loop: "{{ rgw_instances_all }}"
|
|
|
|
run_once: true
|
|
|
|
when:
|
|
|
|
- hostvars[item.host]['rgw_zonemaster'] | bool
|
|
|
|
- hostvars[item.host]['rgw_zonegroupmaster'] | bool
|
|
|
|
|
2019-10-05 03:31:25 +08:00
|
|
|
- name: check if the realm system user already exists
|
2020-03-09 18:05:01 +08:00
|
|
|
command: "{{ container_exec_cmd }} radosgw-admin user info --cluster={{ cluster }} --rgw-realm={{ item.realm }} --rgw-zonegroup={{ item.zonegroup }} --rgw-zone={{ item.zone }} --uid={{ item.user }}"
|
2019-10-05 03:31:25 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
register: usercheck
|
|
|
|
failed_when: False
|
|
|
|
changed_when: False
|
|
|
|
check_mode: no
|
2020-03-09 18:05:01 +08:00
|
|
|
run_once: True
|
|
|
|
loop: "{{ zone_users }}"
|
2019-10-05 03:31:25 +08:00
|
|
|
|
|
|
|
- name: create the zone user(s)
|
2020-03-09 18:05:01 +08:00
|
|
|
command: "{{ container_exec_cmd }} radosgw-admin user create --cluster={{ cluster }} --rgw-realm={{ item.item.realm }} --rgw-zonegroup={{ item.item.zonegroup }} --rgw-zone={{ item.item.zone }} --uid={{ item.item.user }} --display-name='{{ item.item.display_name }}' --access-key={{ item.item.system_access_key }} --secret={{ item.item.system_secret_key }} --system"
|
2019-10-05 03:31:25 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
run_once: true
|
2020-03-09 18:05:01 +08:00
|
|
|
loop: "{{ usercheck.results }}"
|
|
|
|
when:
|
|
|
|
- zone_users is defined
|
|
|
|
- "'could not fetch user info: no user info saved' in item.stderr"
|