Skip to content

Commit aa0cc93

Browse files
committed
dashboard: support --limit execution with rgw
When the following conditions are met: - rgw is deployed, - dashboard is deployed, - playbook is called with --limit, - a node being processed is collocated on either a mon or mgr. The playbook fails because `rgw_instances` is undefined. The idea here is to make sure this variable is always defined. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2063029 Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
1 parent 79b1ad4 commit aa0cc93

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

roles/ceph-dashboard/tasks/configure_dashboard.yml

+7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
delegate_to: "{{ item }}"
2525
delegate_facts: True
2626

27+
- include_role:
28+
name: ceph-facts
29+
tasks_from: set_radosgw_address.yml
30+
loop: "{{ groups[rgw_group_name] }}"
31+
loop_control:
32+
loop_var: ceph_dashboard_call_item
33+
2734
- name: disable SSL for dashboard
2835
when: dashboard_protocol == "http"
2936
delegate_to: "{{ groups[mon_group_name][0] }}"

roles/ceph-facts/tasks/set_radosgw_address.yml

+20-7
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,34 @@
3131
- name: set_fact _interface
3232
set_fact:
3333
_interface: "{{ (radosgw_interface | replace('-', '_')) }}"
34+
loop: "{{ groups.get(rgw_group_name, []) }}"
35+
delegate_to: "{{ item }}"
3436

3537
- name: set_fact _radosgw_address to radosgw_interface - ipv4
3638
set_fact:
37-
_radosgw_address: "{{ hostvars[inventory_hostname]['ansible_facts'][_interface][ip_version]['address'] }}"
39+
_radosgw_address: "{{ hostvars[item]['ansible_facts'][_interface][ip_version]['address'] }}"
40+
loop: "{{ groups.get(rgw_group_name, []) }}"
41+
delegate_to: "{{ item }}"
42+
delegate_facts: true
3843
when: ip_version == 'ipv4'
3944

4045
- name: set_fact _radosgw_address to radosgw_interface - ipv6
4146
set_fact:
42-
_radosgw_address: "{{ hostvars[inventory_hostname]['ansible_facts'][_interface][ip_version][0]['address'] | ipwrap }}"
47+
_radosgw_address: "{{ hostvars[item]['ansible_facts'][_interface][ip_version][0]['address'] | ipwrap }}"
48+
loop: "{{ groups.get(rgw_group_name, []) }}"
49+
delegate_to: "{{ item }}"
50+
delegate_facts: true
4351
when: ip_version == 'ipv6'
4452

4553
- name: set_fact rgw_instances without rgw multisite
4654
set_fact:
47-
rgw_instances: "{{ rgw_instances|default([]) | union([{'instance_name': 'rgw' + item|string, 'radosgw_address': _radosgw_address, 'radosgw_frontend_port': radosgw_frontend_port|int + item|int }]) }}"
55+
rgw_instances: "{{ rgw_instances|default([]) | union([{'instance_name': 'rgw' + item|string, 'radosgw_address': hostvars[ceph_dashboard_call_item | default(inventory_hostname)]['_radosgw_address'], 'radosgw_frontend_port': radosgw_frontend_port|int + item|int }]) }}"
4856
with_sequence: start=0 end={{ radosgw_num_instances|int - 1 }}
57+
delegate_to: "{{ ceph_dashboard_call_item if ceph_dashboard_call_item is defined else inventory_hostname }}"
58+
delegate_facts: "{{ true if ceph_dashboard_call_item is defined else false }}"
4959
when:
50-
- inventory_hostname in groups.get(rgw_group_name, [])
60+
- ceph_dashboard_call_item is defined or
61+
inventory_hostname in groups.get(rgw_group_name, [])
5162
- not rgw_multisite | bool
5263

5364
- name: set_fact is_rgw_instances_defined
@@ -59,10 +70,13 @@
5970

6071
- name: set_fact rgw_instances with rgw multisite
6172
set_fact:
62-
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 }]) }}"
73+
rgw_instances: "{{ rgw_instances|default([]) | union([{ 'instance_name': 'rgw' + item | string, 'radosgw_address': hostvars[ceph_dashboard_call_item | default(inventory_hostname)]['_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 }]) }}"
6374
with_sequence: start=0 end={{ radosgw_num_instances|int - 1 }}
75+
delegate_to: "{{ ceph_dashboard_call_item if ceph_dashboard_call_item is defined else inventory_hostname }}"
76+
delegate_facts: "{{ true if ceph_dashboard_call_item is defined else false }}"
6477
when:
65-
- inventory_hostname in groups.get(rgw_group_name, [])
78+
- ceph_dashboard_call_item is defined or
79+
inventory_hostname in groups.get(rgw_group_name, [])
6680
- rgw_multisite | bool
6781
- not is_rgw_instances_defined | default(False) | bool
6882

@@ -78,7 +92,6 @@
7892
set_fact:
7993
rgw_instances_all: '{{ rgw_instances_all | default([]) | union(hostvars[item]["rgw_instances_host"]) }}'
8094
with_items: "{{ groups.get(rgw_group_name, []) }}"
81-
run_once: true
8295
when:
8396
- inventory_hostname in groups.get(rgw_group_name, [])
8497
- hostvars[item]["rgw_instances_host"] is defined

0 commit comments

Comments
 (0)