]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
config: ensure rgw section has the correct name
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 9 Aug 2018 09:03:32 +0000 (11:03 +0200)
committerSébastien Han <seb@redhat.com>
Mon, 13 Aug 2018 08:04:24 +0000 (10:04 +0200)
the ceph.conf.j2 always assumes the hostname used to register the
radosgw in the servicemap is equivalent to `{{ ansible_hostname }}`
which returns the shortname form.

We need to detect which form of the hostname was used in case of already
deployed cluster and update the ceph.conf accordingly.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1580408
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-config/templates/ceph.conf.j2
roles/ceph-defaults/tasks/facts.yml

index d48f17f18efb2e28aae47a2d3ffe3eef46f763b8..f9ccda2a8ba75141c71c6e1b71615a6bd1e78c13 100644 (file)
@@ -155,9 +155,10 @@ filestore xattr use omap = true
 
 {% if inventory_hostname in groups.get(rgw_group_name, []) %}
 {% for host in groups[rgw_group_name] %}
-[client.rgw.{{ hostvars[host]['ansible_hostname'] }}]
-host = {{ hostvars[host]['ansible_hostname'] }}
-keyring = /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ hostvars[host]['ansible_hostname'] }}/keyring
+{# {{ hostvars[host]['rgw_hostname'] }} for backward compatibility, fqdn issues. See bz1580408 #}
+[client.rgw.{{ hostvars[host]['rgw_hostname'] }}]
+host = {{ hostvars[host]['rgw_hostname'] }}
+keyring = /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ hostvars[host]['rgw_hostname'] }}/keyring
 log file = /var/log/ceph/{{ cluster }}-rgw-{{ hostvars[host]['ansible_hostname'] }}.log
 {% if hostvars[host]['radosgw_address_block'] is defined and hostvars[host]['radosgw_address_block'] != 'subnet' %}
     {% if ip_version == 'ipv4' %}
@@ -204,9 +205,9 @@ rgw frontends = {{ radosgw_frontend_type }} {{ 'port' if radosgw_frontend_type =
 {% if inventory_hostname in groups.get(nfs_group_name, []) and inventory_hostname not in groups.get(rgw_group_name, []) %}
 {% for host in groups[nfs_group_name] %}
 {% if nfs_obj_gw %}
-[client.rgw.{{ hostvars[host]['ansible_hostname'] }}]
-host = {{ hostvars[host]['ansible_hostname'] }}
-keyring = /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ hostvars[host]['ansible_hostname'] }}/keyring
+[client.rgw.{{ hostvars[host]['rgw_hostname'] }}]
+host = {{ hostvars[host]['rgw_hostname'] }}
+keyring = /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ hostvars[host]['rgw_hostname'] }}/keyring
 log file = /var/log/ceph/{{ cluster }}-rgw-{{ hostvars[host]['ansible_hostname'] }}.log
 {% endif %}
 {% endfor %}
index b3e28b3682dce64fc59434c989acd6581c0261f9..d843756fd6186b8e8e97e9cd0f72a736909fdfca 100644 (file)
   when:
     - containerized_deployment
     - ceph_docker_image | search("rhceph")
+
+- block:
+    - name: get current cluster status (if already running)
+      command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} -s -f json"
+      register: ceph_current_status
+
+    - name: set_fact ceph_current_status (convert to json)
+      set_fact:
+        ceph_current_status: "{{ ceph_current_status.stdout | from_json }}"
+
+    - name: set_fact rgw_hostname
+      set_fact:
+        rgw_hostname: "{% for key in ceph_current_status['servicemap']['services']['rgw']['daemons'].keys() %}{% if key == ansible_fqdn %}{{ key }}{% endif %}{% endfor %}"
+  when:
+    - ceph_current_fsid.get('rc', 1) == 0
+    - inventory_hostname in groups.get(rgw_group_name, [])
+    # no servicemap before luminous
+    - ceph_release_num[ceph_release] >= ceph_release_num['luminous']
+    - ansible_hostname != ansible_fqdn
+
+- name: set_fact rgw_hostname
+  set_fact:
+    rgw_hostname: "{{ ansible_hostname }}"
+  when:
+    - rgw_hostname is undefined
\ No newline at end of file