mirror of https://github.com/ceph/ceph-ansible.git
ceph.conf.j2: check if interface is defined before using it
ceph-mon.service.j2: remove redundant --name option from docker command Signed-off-by: Huamin Chen <hchen@redhat.com>pull/812/head
parent
c4f9bf8d13
commit
8320085a66
|
@ -30,13 +30,17 @@ host = {{ hostvars[host]['ansible_fqdn'] }}
|
|||
host = {{ hostvars[host]['ansible_hostname'] }}
|
||||
{% endif %}
|
||||
# we need to check if monitor_interface is defined in the inventory per host or if it's set in a group_vars file
|
||||
{% if mon_containerized_deployment or mon_containerized_deployment_with_kv %}
|
||||
{% if mon_containerized_deployment %}
|
||||
{% set interface = ["ansible_",ceph_mon_docker_interface]|join %}
|
||||
{% if (hostvars[host][interface] is defined and hostvars[host][interface] != "interface") or interface != "interface" %}
|
||||
{% if interface in hostvars[host] and 'ipv4' in hostvars[host][interface] %}
|
||||
# user address from interface {{ ceph_mon_docker_interface }}
|
||||
mon addr = {{ hostvars[host][interface]['ipv4']['address'] }}
|
||||
{% else %}
|
||||
mon addr = {{ hostvars[host]['monitor_address'] if hostvars[host]['monitor_address'] is defined else monitor_address }}
|
||||
{% elif hostvars[host]['monitor_address'] is defined %}
|
||||
# use host monitor address
|
||||
mon addr = {{ hostvars[host]['monitor_address'] }}
|
||||
{% elif monitor_address != "0.0.0.0" %}
|
||||
# use group_var monitor address
|
||||
mon addr = monitor_address
|
||||
{% endif %}
|
||||
{% elif (hostvars[host]['monitor_interface'] is defined and hostvars[host]['monitor_interface'] != "interface") or monitor_interface != "interface" %}
|
||||
{% include 'mon_addr_interface.j2' %}
|
||||
|
|
|
@ -24,7 +24,6 @@ ExecStart=/usr/bin/docker run --rm --name %i --net=host \
|
|||
-e MON_IP={{ hostvars[inventory_hostname]['ansible_' + ceph_mon_docker_interface]['ipv4']['address'] }} \
|
||||
-e CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }} \
|
||||
-e MON_NAME={{ ansible_hostname }} \
|
||||
--name={{ ansible_hostname }} \
|
||||
{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}
|
||||
ExecStopPost=-/usr/bin/docker stop %i
|
||||
Restart=always
|
||||
|
|
Loading…
Reference in New Issue