From db29b5b84dbc6f4a940f2da6c5f1e68547a91f4a Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Thu, 9 Aug 2018 10:44:34 +0200 Subject: [PATCH] config: clean template, remove useless conditions there is no need to have all these conditions. for instance, assuming `mds_group_name` is set to 'mdss': - `if groups[mds_group_name] is defined` checks if `'mdss'` is present in `{{ groups }}` - `if {{ mds_group_name }} in group_names` checks if the current node is part the group `'mdss'` - `if inventory_hostname in groups.get(mds_group_name, [])` checks if the current node is part of the group 'mdss' The third condition is enough to cover the need of ensuring we are running on a mds node. Signed-off-by: Guillaume Abrioux --- roles/ceph-config/templates/ceph.conf.j2 | 32 ------------------------ 1 file changed, 32 deletions(-) diff --git a/roles/ceph-config/templates/ceph.conf.j2 b/roles/ceph-config/templates/ceph.conf.j2 index 03fae5a51..d48f17f18 100644 --- a/roles/ceph-config/templates/ceph.conf.j2 +++ b/roles/ceph-config/templates/ceph.conf.j2 @@ -153,27 +153,8 @@ filestore xattr use omap = true {% endif %} {% endif %} -{% if groups[mds_group_name] is defined %} -{% if mds_group_name in group_names %} -{% if inventory_hostname in groups.get(mds_group_name, []) %} -{% for host in groups[mds_group_name] %} -{% if hostvars[host]['ansible_fqdn'] is defined and mds_use_fqdn %} -[mds.{{ hostvars[host]['ansible_fqdn'] }}] -host = {{ hostvars[host]['ansible_fqdn'] }} -{% elif hostvars[host]['ansible_hostname'] is defined %} -[mds.{{ hostvars[host]['ansible_hostname'] }}] -host = {{ hostvars[host]['ansible_hostname'] }} -{% endif %} -{% endfor %} -{% endif %} -{% endif %} -{% endif %} - -{% if groups[rgw_group_name] is defined %} -{% if rgw_group_name in group_names %} {% if inventory_hostname in groups.get(rgw_group_name, []) %} {% for host in groups[rgw_group_name] %} -{% if hostvars[host]['ansible_hostname'] is defined %} [client.rgw.{{ hostvars[host]['ansible_hostname'] }}] host = {{ hostvars[host]['ansible_hostname'] }} keyring = /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ hostvars[host]['ansible_hostname'] }}/keyring @@ -217,31 +198,20 @@ rgw frontends = {{ radosgw_frontend_type }} {{ 'port' if radosgw_frontend_type = rgw frontends = {{ radosgw_frontend_type }} {{ 'port' if radosgw_frontend_type == 'civetweb' else 'endpoint' }}=[{{ hostvars[host][interface][ip_version][0]['address'] }}]:{{ radosgw_frontend_port }} {{ radosgw_frontend_options }} {% endif %} {% endif %} -{% endif %} {% endfor %} {% endif %} -{% endif %} -{% endif %} -{% if groups[nfs_group_name] is defined %} -{% if nfs_group_name in group_names %} {% if inventory_hostname in groups.get(nfs_group_name, []) and inventory_hostname not in groups.get(rgw_group_name, []) %} {% for host in groups[nfs_group_name] %} {% if nfs_obj_gw %} -{% if hostvars[host]['ansible_hostname'] is defined %} [client.rgw.{{ hostvars[host]['ansible_hostname'] }}] host = {{ hostvars[host]['ansible_hostname'] }} keyring = /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ hostvars[host]['ansible_hostname'] }}/keyring log file = /var/log/ceph/{{ cluster }}-rgw-{{ hostvars[host]['ansible_hostname'] }}.log {% endif %} -{% endif %} {% endfor %} {% endif %} -{% endif %} -{% endif %} -{% if groups[restapi_group_name] is defined %} -{% if restapi_group_name in group_names %} {% if inventory_hostname in groups.get(restapi_group_name, []) %} [client.restapi] {% if restapi_interface != "interface" %} @@ -252,5 +222,3 @@ log file = /var/log/ceph/{{ cluster }}-rgw-{{ hostvars[host]['ansible_hostname'] keyring = /var/lib/ceph/restapi/ceph-restapi/keyring log file = /var/log/ceph/ceph-restapi.log {% endif %} -{% endif %} -{% endif %} -- 2.39.5