From: Sébastien Han Date: Sun, 8 Oct 2017 13:16:40 +0000 (+0200) Subject: config: do not duplicate sections when doing collocation X-Git-Tag: v3.0.0rc19^2~10 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=1bd891232c98ac254d40a6c05ee14aa093abc0d7;p=ceph-ansible.git config: do not duplicate sections when doing collocation Prior to this commit, when collocating a RGW and NFS on the same box the ceph.conf layout was the following: [client.rgw.rgw0] host = mds0 host = rgw0 rgw frontends = civetweb port=192.168.15.50:8080 num_threads=100[client.rgw.mds0] rgw frontends = civetweb port=192.168.15.70:8080 num_threads=100 rgw frontends = civetweb port=192.168.15.50:8080 num_threads=100 keyring = /var/lib/ceph/radosgw/test-rgw.mds0/keyring keyring = /var/lib/ceph/radosgw/test-rgw.rgw0/keyring rgw data = /var/lib/ceph/radosgw/test-rgw.rgw0 log file = /var/log/ceph/test-rgw-mds0.log log file = /var/log/ceph/test-rgw-rgw0.log [mds.mds0] host = mds0 [global] rgw override bucket index max shards = 16 fsid = 70e1d368-57b3-4978-b746-cbffce6e56b5 rgw bucket default quota max objects = 1638400 osd_pool_default_size = 1 public network = 192.168.15.0/24 mon host = 192.168.15.10,192.168.15.11,192.168.15.12 osd_pool_default_pg_num = 8 cluster network = 192.168.16.0/24 [mds.rgw0] host = rgw0 [client.rgw.mds0] host = mds0 rgw data = /var/lib/ceph/radosgw/test-rgw.mds0 keyring = /var/lib/ceph/radosgw/test-rgw.mds0/keyring rgw frontends = civetweb port=192.168.15.70:8080 num_threads=100 log file = /var/log/ceph/test-rgw-mds0.log Basically appending all the sections. This commits solves that. Now the sections appear like this: -bash-4.2# cat /etc/ceph/test.conf [client.rgw.rgw0] log file = /var/log/ceph/test-rgw-rgw0.log host = rgw0 keyring = /var/lib/ceph/radosgw/test-rgw.rgw0/keyring rgw frontends = civetweb port=192.168.15.50:8080 num_threads=100 [client.rgw.mds0] log file = /var/log/ceph/test-rgw-mds0.log host = mds0 keyring = /var/lib/ceph/radosgw/test-rgw.mds0/keyring rgw frontends = civetweb port=192.168.15.70:8080 num_threads=100 [global] cluster network = 192.168.16.0/24 mon host = 192.168.15.10,192.168.15.11,192.168.15.12 osd_pool_default_size = 1 public network = 192.168.15.0/24 rgw bucket default quota max objects = 1638400 osd_pool_default_pg_num = 8 rgw override bucket index max shards = 16 fsid = 77a21980-3033-4174-9264-1abc7185bcb3 [mds.rgw0] host = rgw0 [mds.mds0] host = mds0 Signed-off-by: Sébastien Han --- diff --git a/roles/ceph-config/templates/ceph.conf.j2 b/roles/ceph-config/templates/ceph.conf.j2 index 22c21e398..2eb2a56e8 100644 --- a/roles/ceph-config/templates/ceph.conf.j2 +++ b/roles/ceph-config/templates/ceph.conf.j2 @@ -132,6 +132,7 @@ filestore xattr use omap = true {% 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'] }}] @@ -143,41 +144,48 @@ host = {{ hostvars[host]['ansible_hostname'] }} {% 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 log file = /var/log/ceph/{{ cluster }}-rgw-{{ hostvars[host]['ansible_hostname'] }}.log -{% if radosgw_address_block | length > 0 %} +{% if hostvars[host]['radosgw_address_block'] is defined and hostvars[host]['radosgw_address_block'] | length > 0 %} {% if ip_version == 'ipv4' -%} rgw frontends = civetweb port={{ hostvars[host]['ansible_all_' + ip_version + '_addresses'] | ipaddr(radosgw_address_block) | first }}:{{ radosgw_civetweb_port }} {{ radosgw_civetweb_options }} {%- elif ip_version == 'ipv6' -%} rgw frontends = civetweb port=[{{ hostvars[host]['ansible_all_' + ip_version + '_addresses'] | ipaddr(radosgw_address_block) | first }}]:{{ radosgw_civetweb_port }} {{ radosgw_civetweb_options }} - {%- endif %} + {%- endif -%} + {% elif hostvars[host]['radosgw_address'] is defined and hostvars[host]['radosgw_address'] != '0.0.0.0' -%} {% if ip_version == 'ipv4' -%} rgw frontends = civetweb port={{ hostvars[host]['radosgw_address'] }}:{{ radosgw_civetweb_port }} {{ radosgw_civetweb_options }} {%- elif ip_version == 'ipv6' -%} rgw frontends = civetweb port=[{{ hostvars[host]['radosgw_address'] }}]:{{ radosgw_civetweb_port }} {{ radosgw_civetweb_options }} - {% endif %} + {%- endif -%} + {%- else -%} {% if ip_version == 'ipv4' -%} rgw frontends = civetweb port={{ hostvars[host]['ansible_' + hostvars[host]['radosgw_interface']][ip_version]['address'] }}:{{ radosgw_civetweb_port }} {{ radosgw_civetweb_options }} {%- elif ip_version == 'ipv6' -%} rgw frontends = civetweb port=[{{ hostvars[host]['ansible_' + hostvars[host]['radosgw_interface']][ip_version][0]['address'] }}]:{{ radosgw_civetweb_port }} {{ radosgw_civetweb_options }} - {% endif %} + {%- 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, []) %} {% for host in groups[nfs_group_name] %} {% if nfs_obj_gw %} {% if hostvars[host]['ansible_hostname'] is defined %} @@ -185,35 +193,16 @@ log file = /var/log/ceph/{{ cluster }}-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 -rgw data = /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ hostvars[host]['ansible_hostname'] }} -{% if radosgw_address_block | length > 0 %} - {% if ip_version == 'ipv4' -%} - rgw frontends = civetweb port={{ hostvars[host]['ansible_all_' + ip_version + '_addresses'] | ipaddr(radosgw_address_block) | first }}:{{ radosgw_civetweb_port }} {{ radosgw_civetweb_options }} - {%- elif ip_version == 'ipv6' -%} - rgw frontends = civetweb port=[{{ hostvars[host]['ansible_all_' + ip_version + '_addresses'] | ipaddr(radosgw_address_block) | first }}]:{{ radosgw_civetweb_port }} {{ radosgw_civetweb_options }} - {%- endif %} -{% elif hostvars[host]['radosgw_address'] is defined and hostvars[host]['radosgw_address'] != '0.0.0.0' -%} - {% if ip_version == 'ipv4' -%} - rgw frontends = civetweb port={{ hostvars[host]['radosgw_address'] }}:{{ radosgw_civetweb_port }} {{ radosgw_civetweb_options }} - {%- elif ip_version == 'ipv6' -%} - rgw frontends = civetweb port=[{{ hostvars[host]['radosgw_address'] }}]:{{ radosgw_civetweb_port }} {{ radosgw_civetweb_options }} - {% endif %} -{%- else -%} - {% set interface = 'ansible_' + hostvars[host]['radosgw_interface'] %} - {% if ip_version == 'ipv6' -%} - rgw frontends = civetweb port=[{{ hostvars[host][interface][ip_version][0]['address'] }}]:{{ radosgw_civetweb_port }} {{ radosgw_civetweb_options }} - {%- elif ip_version == 'ipv4' -%} - rgw frontends = civetweb port={{ hostvars[host][interface][ip_version]['address'] }}:{{ radosgw_civetweb_port }} {{ radosgw_civetweb_options }} - {% endif %} -{%- endif %} {% 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" %} {% include 'client_restapi_interface.j2' %} @@ -224,4 +213,4 @@ keyring = /var/lib/ceph/restapi/ceph-restapi/keyring log file = /var/log/ceph/ceph-restapi.log {% endif %} {% endif %} - +{% endif %}