ceph-rgw-loadbalancer: Fix rgw_ports fact

The `set_fact rgw_ports` task was failing due to a templating error, because
`hostvars[item].rgw_instances` is a list, but it was treated as if it was a
dictionary.

Another issue was the fact that the `unique` filter only applied to the list
being appended to `rgw_ports` instead of the entire list, which means it was
possible to have duplicate items.

Lastly, `rgw_ports` would have been a list of integers, but the `seport` module
expects a list of strings.

This commit fixes all of the issues above, allowing the `ceph-rgw-loadbalancer`
role to work on systems with SELinux enabled.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
(cherry picked from commit c078513475)
pull/6474/head
Benoît Knecht 2021-04-13 13:57:44 +02:00 committed by Guillaume Abrioux
parent e332051b46
commit 8eec148d15
1 changed files with 1 additions and 1 deletions

View File

@ -41,7 +41,7 @@
block: block:
- name: set_fact rgw_ports - name: set_fact rgw_ports
set_fact: set_fact:
rgw_ports: "{{ rgw_ports | default([]) + [hostvars[item]['rgw_instances']['radosgw_frontend_port']] | unique }}" rgw_ports: "{{ rgw_ports | default([]) | union(hostvars[item]['rgw_instances'] | map(attribute='radosgw_frontend_port') | map('string') | list) }}"
with_items: "{{ groups.get(rgw_group_name, []) }}" with_items: "{{ groups.get(rgw_group_name, []) }}"
- name: add selinux rules - name: add selinux rules