defaults: add a default value to rgw_hostname

let's add ansible_hostname as a default value for rgw_hostname if no
hostname in servicemap matches ansible_fqdn.

Fixes: #3063
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1622505

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/3111/head
Guillaume Abrioux 2018-09-05 13:20:47 +02:00
parent 6954ac184f
commit 9ff26e80f2
2 changed files with 17 additions and 17 deletions

View File

@ -155,10 +155,11 @@ filestore xattr use omap = true
{% if inventory_hostname in groups.get(rgw_group_name, []) %}
{% for host in groups[rgw_group_name] %}
{% set rgw_hostname = hostvars[host]['rgw_hostname'] | default(ansible_hostname) %}
{# {{ 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
[client.rgw.{{ rgw_hostname }}]
host = {{ rgw_hostname }}
keyring = /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ 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,10 +205,11 @@ 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] %}
{% set rgw_hostname = hostvars[host]['rgw_hostname'] | default(ansible_hostname) %}
{% if nfs_obj_gw %}
[client.rgw.{{ hostvars[host]['rgw_hostname'] }}]
host = {{ hostvars[host]['rgw_hostname'] }}
keyring = /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ hostvars[host]['rgw_hostname'] }}/keyring
[client.rgw.{{ rgw_hostname }}]
host = {{ rgw_hostname }}
keyring = /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ rgw_hostname }}/keyring
log file = /var/log/ceph/{{ cluster }}-rgw-{{ hostvars[host]['ansible_hostname'] }}.log
{% endif %}
{% endfor %}

View File

@ -225,19 +225,17 @@
- containerized_deployment
- ceph_docker_image | search("rhceph")
- name: set_fact rgw_hostname - fqdn
- 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 %}"
rgw_hostname: "{% set _value = ansible_hostname -%}
{% for key in ceph_current_status['servicemap']['services']['rgw']['daemons'].keys() -%}
{% if key == ansible_fqdn -%}
{% set _value = key -%}
{% endif -%}
{% endfor -%}
{{ _value }}"
when:
- inventory_hostname in groups.get(rgw_group_name, []) or inventory_hostname in groups.get(nfs_group_name, [])
- ceph_current_status['servicemap'] is defined
- ceph_current_status['servicemap']['services'] is defined
- ceph_current_status['servicemap']['services']['rgw'] is defined # that's the way to cover ceph_release_num[ceph_release] >= ceph_release_num['luminous']
- ansible_hostname != ansible_fqdn
- name: set_fact rgw_hostname - no fqdn
set_fact:
rgw_hostname: "{{ ansible_hostname }}"
when:
- inventory_hostname in groups.get(rgw_group_name, []) or inventory_hostname in groups.get(nfs_group_name, [])
- rgw_hostname is undefined
- ceph_current_status['servicemap']['services']['rgw'] is defined # that's the way to cover ceph_release_num[ceph_release] >= ceph_release_num['luminous']