From 49dba08c0580934f74471c98a50a842d4de33375 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Wed, 2 Nov 2016 12:53:32 -0500 Subject: [PATCH 1/4] fixes monitor_address and monitor_interface features Before this commit if you had set monitor_interface in your inventory file for a specific host it would be ignored and the value in group_vars/all would have been used. Also, this enables support for monitor_address again as it had been broken by previous changes to this template. Signed-off-by: Andrew Schoen --- roles/ceph-common/templates/ceph.conf.j2 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/roles/ceph-common/templates/ceph.conf.j2 b/roles/ceph-common/templates/ceph.conf.j2 index 4d72a0b8a..fbbb4d87d 100644 --- a/roles/ceph-common/templates/ceph.conf.j2 +++ b/roles/ceph-common/templates/ceph.conf.j2 @@ -24,11 +24,20 @@ mon_initial_members = {% if groups[mon_group_name] is defined %}{% for host in g {% if monitor_address_block is defined %} mon host = {% for host in groups[mon_group_name] %}{{ hostvars[host]['ansible_all_ipv4_addresses'] | ipaddr(monitor_address_block) | first }}{% if not loop.last %},{% endif %}{% endfor %} {% elif groups[mon_group_name] is defined %} -mon host = {% for host in groups[mon_group_name] %}{% for key in hostvars[host].iterkeys() %}{% if hostvars[host][key]['macaddress'] is defined and hostvars[host][key]['device'] is defined and hostvars[host][key]['device'] == monitor_interface %}{{ hostvars[host][key]['ipv4']['address'] }}{% endif %}{% endfor %}{% if not loop.last %},{% endif %}{% endfor %} -{% elif (hostvars[host]['monitor_interface'] is defined and hostvars[host]['monitor_interface'] != "interface") or monitor_interface != "interface" %} -{% include 'mon_addr_interface.j2' %} -{% else %} -{% include 'mon_addr_address.j2' %} +mon host = {% for host in groups[mon_group_name] %} + {% set address = hostvars[host]['monitor_address'] if hostvars[host]['monitor_address'] is defined else monitor_address %} + {% set interface = hostvars[host]['monitor_interface'] if hostvars[host]['monitor_interface'] is defined else monitor_interface %} + {% if address != "0.0.0.0" -%} + {{ address }} + {%- else %} + {% for key in hostvars[host].iterkeys() %} + {% if hostvars[host][key]['macaddress'] is defined and hostvars[host][key]['device'] is defined and hostvars[host][key]['device'] == interface -%} + {{ hostvars[host][key]['ipv4']['address'] }} + {%- endif %} + {% endfor %} + {% endif %} + {%- if not loop.last %},{% endif %} + {% endfor %} {% endif %} {% endif %} {% if mon_containerized_deployment %} From 66bf9eca203ea58d5f88fa093d25006f47c1c161 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Wed, 2 Nov 2016 15:35:07 -0500 Subject: [PATCH 2/4] ceph-common: remove unused mon_addr_address.j2 template Signed-off-by: Andrew Schoen --- roles/ceph-common/templates/mon_addr_address.j2 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 roles/ceph-common/templates/mon_addr_address.j2 diff --git a/roles/ceph-common/templates/mon_addr_address.j2 b/roles/ceph-common/templates/mon_addr_address.j2 deleted file mode 100644 index 0a6323594..000000000 --- a/roles/ceph-common/templates/mon_addr_address.j2 +++ /dev/null @@ -1 +0,0 @@ -mon host = {% for host in groups[mon_group_name] %}{{ hostvars[host]['monitor_address'] if hostvars[host]['monitor_address'] is defined else monitor_address }}{% if not loop.last %},{% endif %}{% endfor %} From 65544fb6aac8267b4519455d0475f7fc9eef7f1b Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Wed, 2 Nov 2016 15:36:03 -0500 Subject: [PATCH 3/4] ceph-common: remove unused mon_addr_interface.j2 template Signed-off-by: Andrew Schoen --- roles/ceph-common/templates/mon_addr_interface.j2 | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 roles/ceph-common/templates/mon_addr_interface.j2 diff --git a/roles/ceph-common/templates/mon_addr_interface.j2 b/roles/ceph-common/templates/mon_addr_interface.j2 deleted file mode 100644 index 107483177..000000000 --- a/roles/ceph-common/templates/mon_addr_interface.j2 +++ /dev/null @@ -1,7 +0,0 @@ -mon host = {% for host in groups[mon_group_name] %} - {% for key in hostvars[host].iterkeys() %} - {% if hostvars[host][key]['macaddress'] is defined and hostvars[host][key]['device'] is defined and hostvars[host][key]['device'] == monitor_interface %} - {{ hostvars[host][key]['ipv4']['address'] }} - {% endif %} - {% endfor %} -{% if not loop.last %},{% endif %}{% endfor %} From f87aabcb21041749a0f798332bd100125fd85525 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 3 Nov 2016 09:25:03 -0500 Subject: [PATCH 4/4] common: remove underscores in ceph.conf so config names are consistent Signed-off-by: Andrew Schoen --- roles/ceph-common/templates/ceph.conf.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/ceph-common/templates/ceph.conf.j2 b/roles/ceph-common/templates/ceph.conf.j2 index fbbb4d87d..25e513369 100644 --- a/roles/ceph-common/templates/ceph.conf.j2 +++ b/roles/ceph-common/templates/ceph.conf.j2 @@ -17,7 +17,7 @@ osd crush chooseleaf type = 0 {% endif %} {# NOTE (leseb): the blank lines in-between are needed otherwise we won't get any line break #} {% if groups[mon_group_name] is defined %} -mon_initial_members = {% if groups[mon_group_name] is defined %}{% for host in groups[mon_group_name] %}{% if hostvars[host]['ansible_fqdn'] is defined and mon_use_fqdn %}{{ hostvars[host]['ansible_fqdn'] }}{% if not loop.last %},{% endif %}{% elif hostvars[host]['ansible_hostname'] is defined %}{{ hostvars[host]['ansible_hostname'] }}{% if not loop.last %},{% endif %}{% endif %}{% endfor %}{% endif %} +mon initial members = {% if groups[mon_group_name] is defined %}{% for host in groups[mon_group_name] %}{% if hostvars[host]['ansible_fqdn'] is defined and mon_use_fqdn %}{{ hostvars[host]['ansible_fqdn'] }}{% if not loop.last %},{% endif %}{% elif hostvars[host]['ansible_hostname'] is defined %}{{ hostvars[host]['ansible_hostname'] }}{% if not loop.last %},{% endif %}{% endif %}{% endfor %}{% endif %} {% endif %} {% if not mon_containerized_deployment and not mon_containerized_deployment_with_kv %} @@ -60,10 +60,10 @@ monitor_address {% endif %} {% if public_network is defined %} -public_network = {{ public_network }} +public network = {{ public_network }} {% endif %} {% if cluster_network is defined %} -cluster_network = {{ cluster_network }} +cluster network = {{ cluster_network }} {% endif %} [client.libvirt]