mirror of https://github.com/ceph/ceph-ansible.git
ceph-facts: use last ipv6 address for mon/rgw
When using monitor_address_block or radosgw_address_block variables
to configure the mon/rgw address we're getting the first ip address
from the ansible facts present in that cidr.
When there's VIP on that network the first filter could return the
wrong value.
This seems to affect only IPv6 setup because the VIP addresses are
added to the ansible facts at the beginning of the list. This is the
opposite (at the end) when using IPv4.
This causes the mon/rgw processes to bind on the VIP address.
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1680155
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit fd4b0ec7eb
)
pull/3815/merge
parent
af78673328
commit
8715490223
|
@ -1,13 +1,25 @@
|
||||||
---
|
---
|
||||||
- name: set_fact _monitor_address to monitor_address_block
|
- name: set_fact _monitor_address to monitor_address_block ipv4
|
||||||
set_fact:
|
set_fact:
|
||||||
_monitor_addresses: "{{ _monitor_addresses | default([]) + [{ 'name': item, 'addr': hostvars[item]['ansible_all_' + ip_version + '_addresses'] | ipaddr(hostvars[item]['monitor_address_block']) | first | ipwrap }] }}"
|
_monitor_addresses: "{{ _monitor_addresses | default([]) + [{ 'name': item, 'addr': hostvars[item]['ansible_all_ipv4_addresses'] | ipaddr(hostvars[item]['monitor_address_block']) | first }] }}"
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ groups.get(mon_group_name, []) }}"
|
- "{{ groups.get(mon_group_name, []) }}"
|
||||||
when:
|
when:
|
||||||
- "item not in _monitor_addresses | default([]) | selectattr('name', 'defined') | map(attribute='name') | list"
|
- "item not in _monitor_addresses | default([]) | selectattr('name', 'defined') | map(attribute='name') | list"
|
||||||
- hostvars[item]['monitor_address_block'] is defined
|
- hostvars[item]['monitor_address_block'] is defined
|
||||||
- hostvars[item]['monitor_address_block'] != 'subnet'
|
- hostvars[item]['monitor_address_block'] != 'subnet'
|
||||||
|
- ip_version == 'ipv4'
|
||||||
|
|
||||||
|
- name: set_fact _monitor_address to monitor_address_block ipv6
|
||||||
|
set_fact:
|
||||||
|
_monitor_addresses: "{{ _monitor_addresses | default([]) + [{ 'name': item, 'addr': hostvars[item]['ansible_all_ipv6_addresses'] | ipaddr(hostvars[item]['monitor_address_block']) | last | ipwrap }] }}"
|
||||||
|
with_items:
|
||||||
|
- "{{ groups.get(mon_group_name, []) }}"
|
||||||
|
when:
|
||||||
|
- "item not in _monitor_addresses | default([]) | selectattr('name', 'defined') | map(attribute='name') | list"
|
||||||
|
- hostvars[item]['monitor_address_block'] is defined
|
||||||
|
- hostvars[item]['monitor_address_block'] != 'subnet'
|
||||||
|
- ip_version == 'ipv6'
|
||||||
|
|
||||||
- name: set_fact _monitor_address to monitor_address
|
- name: set_fact _monitor_address to monitor_address
|
||||||
set_fact:
|
set_fact:
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
---
|
---
|
||||||
- name: set_fact _radosgw_address to radosgw_address_block
|
- name: set_fact _radosgw_address to radosgw_address_block ipv4
|
||||||
set_fact:
|
set_fact:
|
||||||
_radosgw_address: "{{ hostvars[inventory_hostname]['ansible_all_' + ip_version + '_addresses'] | ipaddr(radosgw_address_block) | first | ipwrap }}"
|
_radosgw_address: "{{ hostvars[inventory_hostname]['ansible_all_ipv4_addresses'] | ipaddr(radosgw_address_block) | first }}"
|
||||||
when:
|
when:
|
||||||
- radosgw_address_block is defined
|
- radosgw_address_block is defined
|
||||||
- radosgw_address_block != 'subnet'
|
- radosgw_address_block != 'subnet'
|
||||||
|
- ip_version == 'ipv4'
|
||||||
|
|
||||||
|
- name: set_fact _radosgw_address to radosgw_address_block ipv6
|
||||||
|
set_fact:
|
||||||
|
_radosgw_address: "{{ hostvars[inventory_hostname]['ansible_all_ipv6_addresses'] | ipaddr(radosgw_address_block) | last | ipwrap }}"
|
||||||
|
when:
|
||||||
|
- radosgw_address_block is defined
|
||||||
|
- radosgw_address_block != 'subnet'
|
||||||
|
- ip_version == 'ipv6'
|
||||||
|
|
||||||
- name: set_fact _radosgw_address to radosgw_address
|
- name: set_fact _radosgw_address to radosgw_address
|
||||||
set_fact:
|
set_fact:
|
||||||
|
|
Loading…
Reference in New Issue