config: ensure rgw section has the correct name

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>
pull/3007/head
Guillaume Abrioux 2018-08-09 11:03:32 +02:00 committed by Sébastien Han
parent db29b5b84d
commit f422efb1d6
2 changed files with 32 additions and 6 deletions

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

View File

@ -217,3 +217,28 @@
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