]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph.conf.j2: check if interface is defined before using it 812/head
authorHuamin Chen <hchen@redhat.com>
Mon, 6 Jun 2016 17:34:51 +0000 (17:34 +0000)
committerHuamin Chen <hchen@redhat.com>
Mon, 6 Jun 2016 17:34:51 +0000 (17:34 +0000)
ceph-mon.service.j2: remove redundant --name option from docker command

Signed-off-by: Huamin Chen <hchen@redhat.com>
roles/ceph-common/templates/ceph.conf.j2
roles/ceph-mon/templates/ceph-mon.service.j2

index ca2c55b06c0952a24ef6b8056b36f7ac5754edf7..12370bdbe8bc3c4c7771854dec919b91e1434f58 100644 (file)
@@ -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' %}
index ab9c384ad4ccb98da5349587eb5b4cb2c20dee8a..110cee4575ccec1edec19b8a77c22e61686440a4 100644 (file)
@@ -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