ceph.conf: add variable setting monitor addr block

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>
pull/982/head
Patrick Donnelly 2016-09-19 17:35:41 -04:00
parent 112a2b2970
commit bcb2e39017
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
2 changed files with 6 additions and 3 deletions

View File

@ -40,12 +40,13 @@
- osd_objectstore != 'bluestore' - osd_objectstore != 'bluestore'
- osd_group_name in group_names - 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: 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: when:
- monitor_interface == 'interface' - monitor_interface == 'interface'
- monitor_address == '0.0.0.0' - monitor_address == '0.0.0.0'
- not monitor_address_block
- mon_group_name in group_names - mon_group_name in group_names
- name: make sure cluster_network configured - name: make sure cluster_network configured

View File

@ -21,7 +21,9 @@ mon_initial_members = {% if groups[mon_group_name] is defined %}{% for host in g
{% endif %} {% endif %}
{% if not mon_containerized_deployment and not mon_containerized_deployment_with_kv %} {% 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 %} 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" %} {% elif (hostvars[host]['monitor_interface'] is defined and hostvars[host]['monitor_interface'] != "interface") or monitor_interface != "interface" %}
{% include 'mon_addr_interface.j2' %} {% include 'mon_addr_interface.j2' %}