diff --git a/roles/ceph-config/templates/ceph.conf.j2 b/roles/ceph-config/templates/ceph.conf.j2 index d48f17f18..f9ccda2a8 100644 --- a/roles/ceph-config/templates/ceph.conf.j2 +++ b/roles/ceph-config/templates/ceph.conf.j2 @@ -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 %} diff --git a/roles/ceph-defaults/tasks/facts.yml b/roles/ceph-defaults/tasks/facts.yml index b3e28b368..d843756fd 100644 --- a/roles/ceph-defaults/tasks/facts.yml +++ b/roles/ceph-defaults/tasks/facts.yml @@ -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 \ No newline at end of file