From 0a581a6e6007812cdad935e4f65909b4306046b2 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Thu, 23 Jul 2020 21:12:46 +0200 Subject: [PATCH] config: only add related rgw section there's no need to add each rgw section on all rgw nodes. With this commit, only related rgw section are rendered. Signed-off-by: Guillaume Abrioux --- roles/ceph-config/templates/ceph.conf.j2 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/roles/ceph-config/templates/ceph.conf.j2 b/roles/ceph-config/templates/ceph.conf.j2 index c9634c117..b15068832 100644 --- a/roles/ceph-config/templates/ceph.conf.j2 +++ b/roles/ceph-config/templates/ceph.conf.j2 @@ -105,15 +105,14 @@ osd memory target = {{ _osd_memory_target | default(osd_memory_target) }} {% endif %} {% if inventory_hostname in groups.get(rgw_group_name, []) %} -{% for host in groups[rgw_group_name] %} -{% set _rgw_hostname = hostvars[host]['rgw_hostname'] | default(hostvars[host]['ansible_hostname']) %} +{% set _rgw_hostname = hostvars[inventory_hostname]['rgw_hostname'] | default(hostvars[inventory_hostname]['ansible_hostname']) %} {# {{ hostvars[host]['rgw_hostname'] }} for backward compatibility, fqdn issues. See bz1580408 #} -{% if hostvars[host]['rgw_instances'] is defined %} -{% for instance in hostvars[host]['rgw_instances'] %} +{% if hostvars[inventory_hostname]['rgw_instances'] is defined %} +{% for instance in hostvars[inventory_hostname]['rgw_instances'] %} [client.rgw.{{ _rgw_hostname + '.' + instance['instance_name'] }}] host = {{ _rgw_hostname }} keyring = /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ _rgw_hostname + '.' + instance['instance_name'] }}/keyring -log file = /var/log/ceph/{{ cluster }}-rgw-{{ hostvars[host]['ansible_hostname'] + '.' + instance['instance_name'] }}.log +log file = /var/log/ceph/{{ cluster }}-rgw-{{ hostvars[inventory_hostname]['ansible_hostname'] + '.' + instance['instance_name'] }}.log {% set _rgw_binding_socket = instance['radosgw_address'] | default(_radosgw_address) | string + ':' + instance['radosgw_frontend_port'] | default(radosgw_frontend_port) | string %} {%- macro frontend_line(frontend_type) -%} {%- if frontend_type == 'civetweb' -%} @@ -133,7 +132,6 @@ rgw_zone = {{ instance['rgw_zone'] }} {% endif %} {% endfor %} {% endif %} -{% endfor %} {% endif %} {% if inventory_hostname in groups.get(nfs_group_name, []) and inventory_hostname not in groups.get(rgw_group_name, []) %}