]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph.conf: add variable setting monitor addr block
authorPatrick Donnelly <pdonnell@redhat.com>
Mon, 19 Sep 2016 21:35:41 +0000 (17:35 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 19 Sep 2016 21:35:41 +0000 (17:35 -0400)
For some providers (such as upcoming Linode support), some NICs may have
multiple IP addresses. (In the case of Linode, the only NIC has a public
and private IP address.) This is normally okay as we can use the
ceph.conf cluster_network and public_network variables to force the
monitor to listen on the addresses we want. However, we also need
ansible to set the correct monitor IP addresses in "mon hosts" (i.e. the
addresses the monitors will listen on!). This new monitor_address_block
setting tells ansible which IP address to use for each monitor.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
roles/ceph-common/tasks/checks/check_mandatory_vars.yml
roles/ceph-common/templates/ceph.conf.j2

index ed800d992fdb410fc656dd6da2534608a60feaf2..9750495110257ac3cad69fdd205c19cc5ed43002 100644 (file)
     - osd_objectstore != 'bluestore'
     - osd_group_name in group_names
 
-- name: make sure monitor_interface or monitor_address is configured
+- name: make sure monitor_interface or monitor_address or monitor_address_block is configured
   fail:
-    msg: "monitor_interface or monitor_address must be configured. Interface for the monitor to listen on or IP address of that interface"
+    msg: "Either monitor_interface, monitor_address, or monitor_address_block must be configured. Interface for the monitor to listen on or IP address of that interface"
   when:
     - monitor_interface == 'interface'
     - monitor_address == '0.0.0.0'
+    - not monitor_address_block
     - mon_group_name in group_names
 
 - name: make sure cluster_network configured
index f04f6d441f49d9dd58aefeea80099a9ad361ec8e..61bd2cf426ae10694c9e87b448dfc9d80fe903da 100644 (file)
@@ -21,7 +21,9 @@ mon_initial_members = {% if groups[mon_group_name] is defined %}{% for host in g
 {% endif %}
 
 {% if not mon_containerized_deployment and not mon_containerized_deployment_with_kv %}
-{% if groups[mon_group_name] is defined %}
+{% 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] %}{{ hostvars[host]['ansible_' + monitor_interface]['ipv4']['address'] }}{% 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' %}