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' %}
-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