diff --git a/roles/ceph-common/templates/ceph.conf.j2 b/roles/ceph-common/templates/ceph.conf.j2 index ca2c55b06..12370bdbe 100644 --- a/roles/ceph-common/templates/ceph.conf.j2 +++ b/roles/ceph-common/templates/ceph.conf.j2 @@ -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' %} diff --git a/roles/ceph-mon/templates/ceph-mon.service.j2 b/roles/ceph-mon/templates/ceph-mon.service.j2 index ab9c384ad..110cee457 100644 --- a/roles/ceph-mon/templates/ceph-mon.service.j2 +++ b/roles/ceph-mon/templates/ceph-mon.service.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