ceph-ansible/roles/ceph-facts/tasks/set_radosgw_address.yml

45 lines
1.5 KiB
YAML
Raw Normal View History

---
- name: set_fact _radosgw_address to radosgw_address_block ipv4
set_fact:
_radosgw_address: "{{ hostvars[inventory_hostname]['ansible_all_ipv4_addresses'] | ipaddr(radosgw_address_block) | first }}"
when:
- radosgw_address_block is defined
- 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
set_fact:
_radosgw_address: "{{ radosgw_address | ipwrap }}"
when:
- radosgw_address is defined
- radosgw_address != '0.0.0.0'
- block:
- name: set_fact _interface
set_fact:
_interface: "{{ 'ansible_' + (radosgw_interface | replace('-', '_')) }}"
- name: set_fact _radosgw_address to radosgw_interface - ipv4
set_fact:
_radosgw_address: "{{ hostvars[inventory_hostname][_interface][ip_version]['address'] }}"
when:
- ip_version == 'ipv4'
- name: set_fact _radosgw_address to radosgw_interface - ipv6
set_fact:
_radosgw_address: "{{ hostvars[inventory_hostname][_interface][ip_version][0]['address'] }}"
when:
- ip_version == 'ipv6'
when:
- radosgw_address_block == 'subnet'
- radosgw_address == '0.0.0.0'
- radosgw_interface != 'interface'