From: Benoît Knecht Date: Tue, 13 Apr 2021 11:57:44 +0000 (+0200) Subject: ceph-rgw-loadbalancer: Fix rgw_ports fact X-Git-Tag: v5.0.6~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fb35ca364bc837d9dc0db703d3740c8089a66765;p=ceph-ansible.git 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 (cherry picked from commit c07851347521b09c39b556818378767fc23f05e5) --- diff --git a/roles/ceph-rgw-loadbalancer/tasks/pre_requisite.yml b/roles/ceph-rgw-loadbalancer/tasks/pre_requisite.yml index 01ad14480..f878e760b 100644 --- a/roles/ceph-rgw-loadbalancer/tasks/pre_requisite.yml +++ b/roles/ceph-rgw-loadbalancer/tasks/pre_requisite.yml @@ -41,7 +41,7 @@ block: - name: set_fact rgw_ports 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, []) }}" - name: add selinux rules