]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-common: test mon initial members 815/head
authorSébastien Han <seb@redhat.com>
Fri, 27 May 2016 14:37:07 +0000 (16:37 +0200)
committerSébastien Han <seb@redhat.com>
Tue, 9 Aug 2016 11:50:57 +0000 (13:50 +0200)
Signed-off-by: Sébastien Han <seb@redhat.com>
roles/ceph-common/templates/ceph.conf.j2
roles/ceph-common/templates/mon_addr_address.j2
roles/ceph-common/templates/mon_addr_interface.j2

index aa383c2175fd63f6dad82c87e35e0fcdc9534c59..ebff7b59e2868be29967753f6765a86d1dd728b6 100644 (file)
@@ -8,59 +8,62 @@ auth service required = none
 auth client required = none
 auth supported = none
 {% endif %}
-{% if not mon_containerized_deployment_with_kv %}
+{% if not mon_containerized_deployment_with_kv and not mon_containerized_deployment %}
 fsid = {{ fsid }}
 {% endif %}
 max open files = {{ max_open_files }}
 {% if common_single_host_mode is defined %}
 osd crush chooseleaf type = 0
 {% endif %}
-[client.libvirt]
-admin socket = {{ rbd_client_admin_socket_path }}/$cluster-$type.$id.$pid.$cctid.asok # must be writable by QEMU and allowed by SELinux or AppArmor
-log file = {{ rbd_client_log_file }} # must be writable by QEMU and allowed by SELinux or AppArmor
+{# 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 %}
 
-[mon]
-{% if not mon_containerized_deployment_with_kv %}
-{% for host in groups[mon_group_name] %}
-{% if hostvars[host]['ansible_fqdn'] is defined and mon_use_fqdn %}
-[mon.{{ hostvars[host]['ansible_fqdn'] }}]
-host = {{ hostvars[host]['ansible_fqdn'] }}
-{% elif hostvars[host]['ansible_hostname'] is defined %}
-[mon.{{ hostvars[host]['ansible_hostname'] }}]
-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 %}
-{% set interface = ["ansible_",ceph_mon_docker_interface]|join %}
-{% 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'] }}
- {% 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 %}
+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 %}
 {% 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 %}
+{% 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'] }}
+{% if not loop.last %},{% endif %}
+{% elif hostvars[host]['monitor_address'] is defined %}
+mon_host = {{ hostvars[host]['monitor_address'] }}
+{% if not loop.last %},{% endif %}
+{% elif monitor_address != "0.0.0.0" %}
+mon_host = monitor_address
+{% if not loop.last %},{% endif %}
+{% endif %}
 {% endfor %}
 {% endif %}
+{% endif %}
+
+{% if public_network is defined %}
+public_network = {{ public_network }}
+{% endif %}
+{% if cluster_network is defined %}
+cluster_network = {{ cluster_network }}
+{% endif %}
+max open files = {{ max_open_files }}
+{% if common_single_host_mode is defined %}
+osd crush chooseleaf type = 0
+{% endif %}
+
+[client.libvirt]
+admin socket = {{ rbd_client_admin_socket_path }}/$cluster-$type.$id.$pid.$cctid.asok # must be writable by QEMU and allowed by SELinux or AppArmor
+log file = {{ rbd_client_log_file }} # must be writable by QEMU and allowed by SELinux or AppArmor
 
 [osd]
 osd mkfs type = {{ osd_mkfs_type }}
 osd mkfs options xfs = {{ osd_mkfs_options_xfs }}
 osd mount options xfs = {{ osd_mount_options_xfs }}
 osd journal size = {{ journal_size }}
-{% if cluster_network is defined %}
-cluster_network = {{ cluster_network }}
-{% endif %}
-{% if public_network is defined %}
-public_network = {{ public_network }}
-{% endif %}
 {% if filestore_xattr_use_omap != None %}
 filestore xattr use omap = {{ filestore_xattr_use_omap }}
 {% elif osd_mkfs_type == "ext4" %}
index 19dfa53126bb604ad63939a0917f1d1193d958aa..0a6323594ffc5e713d8a32e5b3b29a050487c202 100644 (file)
@@ -1,2 +1 @@
-mon addr = {{ hostvars[host]['monitor_address'] if hostvars[host]['monitor_address'] is defined else monitor_address }}
-
+mon host = {% for host in groups[mon_group_name] %}{{ hostvars[host]['monitor_address'] if hostvars[host]['monitor_address'] is defined else monitor_address }}{% if not loop.last %},{% endif %}{% endfor %}
index b5c85cd06fa2d96af04431962aeb1514858edbb6..91db007857b87a25ded6901116a7007cbc8d3212 100644 (file)
@@ -1,2 +1 @@
-mon addr = {{ hostvars[host]['ansible_' + (hostvars[host]['monitor_interface'] if hostvars[host]['monitor_interface'] is defined else monitor_interface) ]['ipv4']['address'] }}
-
+mon host = {% for host in groups[mon_group_name] %}{{ hostvars[host]['ansible_' + (hostvars[host]['monitor_interface'] if hostvars[host]['monitor_interface'] is defined else monitor_interface) ]['ipv4']['address'] }}{% if not loop.last %},{% endif %}{% endfor %}