{# NOTE (leseb): the blank lines in-between are needed otherwise we won't get any line break #}
{% if groups[mon_group_name] is defined %}
mon_initial_members = {% if groups[mon_group_name] is defined %}{% for host in groups[mon_group_name] %}{% if hostvars[host]['ansible_fqdn'] is defined and mon_use_fqdn %}{{ hostvars[host]['ansible_fqdn'] }}{% if not loop.last %},{% endif %}{% elif hostvars[host]['ansible_hostname'] is defined %}{{ hostvars[host]['ansible_hostname'] }}{% if not loop.last %},{% endif %}{% endif %}{% endfor %}{% endif %}
+{% endif %}
-mon_host = {% if groups[mon_group_name] is defined %}{% for host in groups[mon_group_name] %}{{ hostvars[host]['ansible_' + monitor_interface]['ipv4']['address'] }}{% if not loop.last %},{% endif %}{% endfor %}{% endif %}
+{% if not mon_containerized_deployment and not mon_containerized_deployment_with_kv %}
+{% if 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 %}
{% elif (hostvars[host]['monitor_interface'] is defined and hostvars[host]['monitor_interface'] != "interface") or monitor_interface != "interface" %}
{% include 'mon_addr_interface.j2' %}
{% else %}
{% include 'mon_addr_address.j2' %}
{% endif %}
+{% endif %}
{% if mon_containerized_deployment %}
fsid = {{ fsid }}
{% if groups[mon_group_name] is defined %}
{% for host in groups[mon_group_name] %}
{% if mon_containerized_deployment %}
{% set interface = ["ansible_",ceph_mon_docker_interface]|join %}
-mon_host = {{ hostvars[host]['ansible_' + interface]['ipv4']['address'] }}
+mon_host = {{ hostvars[host][interface]['ipv4']['address'] }}
{% if not loop.last %},{% endif %}
{% elif hostvars[host]['monitor_address'] is defined %}
mon_host = {{ hostvars[host]['monitor_address'] }}