]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Replace ip_version check with ansible test
authorLukas Bezdicka <lbezdick@redhat.com>
Wed, 19 Apr 2023 11:16:49 +0000 (13:16 +0200)
committerTeoman ONAY <tonay@redhat.com>
Tue, 2 May 2023 12:56:33 +0000 (14:56 +0200)
Instead of checking ip_version variable we should check the input
address for ip version and select code path based on that.

This solves ceph adoption with mixed ipv6 and ipv4 networks.

Resolves: rhbz#2186226
Signed-off-by: Lukas Bezdicka <lbezdick@redhat.com>
(cherry picked from commit 5622a033a9f8a5c32fdd9429f40599d6b37cd7ac)

infrastructure-playbooks/cephadm-adopt.yml

index e51545f7871aa7bbea6141be7f29b0cc838d2274..ee3e39353479964237e31bb9171d2eb765b20ced 100644 (file)
       command: "{{ ceph_cmd }} orch host add {{ ansible_facts['nodename'] }} {{ ansible_facts['all_ipv4_addresses'] | ips_in_ranges(cephadm_mgmt_network.split(',')) | first }} {{ group_names | intersect(adopt_label_group_names) | join(' ') }}"
       changed_when: false
       delegate_to: '{{ groups[mon_group_name][0] }}'
-      when: ip_version == 'ipv4'
+      when: cephadm_mgmt_network is ansible.utils.ipv4
 
     - name: manage nodes with cephadm - ipv6
       command: "{{ ceph_cmd }} orch host add {{ ansible_facts['nodename'] }} {{ ansible_facts['all_ipv6_addresses'] | ips_in_ranges(cephadm_mgmt_network.split(',')) | last | ansible.utils.ipwrap }} {{ group_names | intersect(adopt_label_group_names) | join(' ') }}"
       changed_when: false
       delegate_to: '{{ groups[mon_group_name][0] }}'
-      when: ip_version == 'ipv6'
+      when: cephadm_mgmt_network is ansible.utils.ipv6
 
     - name: add ceph label for core component
       command: "{{ ceph_cmd }} orch host label add {{ ansible_facts['nodename'] }} ceph"