2018-10-03 22:09:33 +08:00
|
|
|
---
|
2019-04-06 03:04:45 +08:00
|
|
|
- name: set_fact _radosgw_address to radosgw_address_block ipv4
|
2018-10-03 22:09:33 +08:00
|
|
|
set_fact:
|
2019-10-03 20:13:01 +08:00
|
|
|
_radosgw_address: "{{ hostvars[inventory_hostname]['ansible_all_ipv4_addresses'] | ips_in_ranges(hostvars[inventory_hostname]['radosgw_address_block'].split(',')) | first }}"
|
2018-10-03 22:09:33 +08:00
|
|
|
when:
|
|
|
|
- radosgw_address_block is defined
|
|
|
|
- radosgw_address_block != 'subnet'
|
2019-04-06 03:04:45 +08:00
|
|
|
- ip_version == 'ipv4'
|
|
|
|
|
|
|
|
- name: set_fact _radosgw_address to radosgw_address_block ipv6
|
|
|
|
set_fact:
|
2019-10-03 20:13:01 +08:00
|
|
|
_radosgw_address: "{{ hostvars[inventory_hostname]['ansible_all_ipv6_addresses'] | ips_in_ranges(hostvars[inventory_hostname]['radosgw_address_block'].split(',')) | last | ipwrap }}"
|
2019-04-06 03:04:45 +08:00
|
|
|
when:
|
|
|
|
- radosgw_address_block is defined
|
|
|
|
- radosgw_address_block != 'subnet'
|
|
|
|
- ip_version == 'ipv6'
|
2018-10-03 22:09:33 +08:00
|
|
|
|
|
|
|
- name: set_fact _radosgw_address to radosgw_address
|
|
|
|
set_fact:
|
|
|
|
_radosgw_address: "{{ radosgw_address | ipwrap }}"
|
|
|
|
when:
|
|
|
|
- radosgw_address is defined
|
2019-12-10 01:23:15 +08:00
|
|
|
- radosgw_address != 'x.x.x.x'
|
2018-10-03 22:09:33 +08:00
|
|
|
|
2019-03-28 16:13:30 +08:00
|
|
|
- name: tasks for radosgw interface
|
|
|
|
when:
|
|
|
|
- radosgw_address_block == 'subnet'
|
2019-12-10 01:23:15 +08:00
|
|
|
- radosgw_address == 'x.x.x.x'
|
2019-03-28 16:13:30 +08:00
|
|
|
- radosgw_interface != 'interface'
|
|
|
|
block:
|
2020-03-09 18:05:01 +08:00
|
|
|
- name: set_fact _interface
|
|
|
|
set_fact:
|
|
|
|
_interface: "{{ 'ansible_' + (radosgw_interface | replace('-', '_')) }}"
|
2018-10-03 22:09:33 +08:00
|
|
|
|
2020-03-09 18:05:01 +08:00
|
|
|
- name: set_fact _radosgw_address to radosgw_interface - ipv4
|
|
|
|
set_fact:
|
|
|
|
_radosgw_address: "{{ hostvars[inventory_hostname][_interface][ip_version]['address'] }}"
|
|
|
|
when: ip_version == 'ipv4'
|
2018-10-03 22:09:33 +08:00
|
|
|
|
2020-03-09 18:05:01 +08:00
|
|
|
- name: set_fact _radosgw_address to radosgw_interface - ipv6
|
|
|
|
set_fact:
|
2020-04-28 04:01:24 +08:00
|
|
|
_radosgw_address: "{{ hostvars[inventory_hostname][_interface][ip_version][0]['address'] | ipwrap }}"
|
2020-03-09 18:05:01 +08:00
|
|
|
when: ip_version == 'ipv6'
|
2020-01-31 23:42:10 +08:00
|
|
|
|
2019-10-05 03:31:25 +08:00
|
|
|
- name: set_fact rgw_instances without rgw multisite
|
2020-01-31 23:42:10 +08:00
|
|
|
set_fact:
|
2019-10-05 03:31:25 +08:00
|
|
|
rgw_instances: "{{ rgw_instances|default([]) | union([{'instance_name': 'rgw' + item|string, 'radosgw_address': _radosgw_address, 'radosgw_frontend_port': radosgw_frontend_port|int + item|int }]) }}"
|
2020-01-31 23:42:10 +08:00
|
|
|
with_sequence: start=0 end={{ radosgw_num_instances|int - 1 }}
|
2019-10-05 03:31:25 +08:00
|
|
|
when:
|
|
|
|
- inventory_hostname in groups.get(rgw_group_name, [])
|
|
|
|
- not rgw_multisite | bool
|
|
|
|
|
|
|
|
- name: set_fact rgw_instances with rgw multisite
|
|
|
|
set_fact:
|
2020-08-03 18:58:50 +08:00
|
|
|
rgw_instances: "{{ rgw_instances|default([]) | union([{ 'instance_name': 'rgw' + item | string, 'radosgw_address': _radosgw_address, 'radosgw_frontend_port': radosgw_frontend_port | int + item|int, 'rgw_realm': rgw_realm | string, 'rgw_zonegroup': rgw_zonegroup | string, 'rgw_zone': rgw_zone | string, 'system_access_key': system_access_key, 'system_secret_key': system_secret_key, 'rgw_zone_user': rgw_zone_user, 'rgw_zone_user_display_name': rgw_zone_user_display_name, 'endpoint': (rgw_pull_proto + '://' + rgw_pullhost + ':' + rgw_pull_port | string) if not rgw_zonemaster | bool and rgw_zonesecondary | bool else omit }]) }}"
|
2019-10-05 03:31:25 +08:00
|
|
|
with_sequence: start=0 end={{ radosgw_num_instances|int - 1 }}
|
2020-03-09 18:05:01 +08:00
|
|
|
when:
|
|
|
|
- inventory_hostname in groups.get(rgw_group_name, [])
|
|
|
|
- rgw_instances is undefined
|
|
|
|
- rgw_multisite | bool
|
|
|
|
|
2020-03-25 05:11:44 +08:00
|
|
|
- name: set_fact rgw_instances_host
|
|
|
|
set_fact:
|
|
|
|
rgw_instances_host: '{{ rgw_instances_host | default([]) | union([item | combine({"host": inventory_hostname})]) }}'
|
|
|
|
with_items: '{{ rgw_instances }}'
|
|
|
|
when:
|
|
|
|
- inventory_hostname in groups.get(rgw_group_name, [])
|
|
|
|
- rgw_multisite | bool
|
|
|
|
|
2020-03-09 18:05:01 +08:00
|
|
|
- name: set_fact rgw_instances_all
|
|
|
|
set_fact:
|
2020-03-25 05:11:44 +08:00
|
|
|
rgw_instances_all: '{{ rgw_instances_all | default([]) | union(hostvars[item]["rgw_instances_host"]) }}'
|
|
|
|
with_items: "{{ groups.get(rgw_group_name, []) }}"
|
2019-10-05 03:31:25 +08:00
|
|
|
when:
|
|
|
|
- inventory_hostname in groups.get(rgw_group_name, [])
|
2020-06-05 05:00:16 +08:00
|
|
|
- hostvars[item]["rgw_multisite"] | default(False) | bool
|