Merge pull request #1884 from ceph/mon-container-ip

mon: add support for monitor_address block for containers
pull/1888/head
Sébastien Han 2017-09-13 01:46:18 +02:00 committed by GitHub
commit 2a1b8a1997
1 changed files with 17 additions and 7 deletions

View File

@ -29,17 +29,27 @@ ExecStart=/usr/bin/docker run --rm --name ceph-mon-%i --net=host \
--net=host \
{% endif -%}
-e IP_VERSION={{ ip_version[-1:] }} \
{% if monitor_address is defined and monitor_address != '0.0.0.0' %}
{% if monitor_address_block | length > 0 %}
{% if ip_version == 'ipv4' -%}
-e MON_IP={{ monitor_address }} \
-e MON_IP={{ hostvars[inventory_hostname]['ansible_all_' + ip_version + '_addresses'] | ipaddr(monitor_address_block) | first }} \
{% elif ip_version == 'ipv6' -%}
-e MON_IP=[{{ monitor_address }}] \
-e MON_IP=[{{ hostvars[inventory_hostname]['ansible_all_' + ip_version + '_addresses'] | ipaddr(monitor_address_block) | first }}] \
{% endif -%}
{% elif hostvars[inventory_hostname]['monitor_address'] is defined and hostvars[inventory_hostname]['monitor_address'] != '0.0.0.0' -%}
{% if ip_version == 'ipv4' -%}
-e MON_IP={{ hostvars[inventory_hostname]['monitor_address'] }} \
{% elif ip_version == 'ipv6' -%}
-e MON_IP=[{{ hostvars[inventory_hostname]['monitor_address'] }}] \
{% endif -%}
{% else -%}
{% set interface = ["ansible_",monitor_interface]|join %}
{% if ip_version == 'ipv6' -%}
-e MON_IP=[{{ hostvars[inventory_hostname][interface][ip_version][0]['address'] }}] \
{% elif ip_version == 'ipv4' -%}
-e MON_IP={{ hostvars[inventory_hostname]['ansible_' + monitor_interface][ip_version]['address'] }} \
{% elif ip_version =='ipv6' -%}
-e MON_IP=[{{ hostvars[inventory_hostname]['ansible_' + monitor_interface][ip_version][0]['address'] }}] \
-e MON_IP={{ hostvars[inventory_hostname][interface][ip_version]['address'] }} \
{% endif -%}
{% endif -%}
-e CLUSTER={{ cluster }} \
-e FSID={{ fsid }} \
-e CEPH_PUBLIC_NETWORK={{ public_network }} \