From 4f2c2af9b4de8a35e7db2894956d625e69488c34 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Thu, 28 Oct 2021 14:12:46 +0200 Subject: [PATCH] cephadm: support adding hosts with ipv6 The current implementation doesn't support adding hosts when using ipv6 addresses. Signed-off-by: Guillaume Abrioux --- infrastructure-playbooks/cephadm-adopt.yml | 11 +++++++++-- infrastructure-playbooks/cephadm.yml | 13 +++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/infrastructure-playbooks/cephadm-adopt.yml b/infrastructure-playbooks/cephadm-adopt.yml index 06ce50da5..fc43f746a 100644 --- a/infrastructure-playbooks/cephadm-adopt.yml +++ b/infrastructure-playbooks/cephadm-adopt.yml @@ -295,10 +295,17 @@ delegate_to: '{{ groups[mon_group_name][0] }}' when: is_hci | bool - - name: manage nodes with cephadm - command: "{{ ceph_cmd }} orch host add {{ ansible_facts['nodename'] }} {{ ansible_facts['all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) }} {{ group_names | join(' ') }}" + - name: manage nodes with cephadm - ipv4 + command: "{{ ceph_cmd }} orch host add {{ ansible_facts['nodename'] }} {{ ansible_facts['all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | first }} {{ group_names | join(' ') }}" changed_when: false delegate_to: '{{ groups[mon_group_name][0] }}' + when: ip_version == 'ipv4' + + - name: manage nodes with cephadm - ipv6 + command: "{{ ceph_cmd }} orch host add {{ ansible_facts['nodename'] }} {{ ansible_facts['all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ipwrap }} {{ group_names | join(' ') }}" + changed_when: false + delegate_to: '{{ groups[mon_group_name][0] }}' + when: ip_version == 'ipv6' - name: add ceph label for core component command: "{{ ceph_cmd }} orch host label add {{ ansible_facts['nodename'] }} ceph" diff --git a/infrastructure-playbooks/cephadm.yml b/infrastructure-playbooks/cephadm.yml index 7456e4c95..f19672ae7 100644 --- a/infrastructure-playbooks/cephadm.yml +++ b/infrastructure-playbooks/cephadm.yml @@ -240,12 +240,21 @@ environment: CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' - - name: manage nodes with cephadm - command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch host add {{ ansible_facts['hostname'] }} {{ ansible_facts['default_ipv4']['address'] }} {{ group_names | join(' ') }} {{ '_admin' if mon_group_name | default('mons') in group_names else '' }}" + - name: manage nodes with cephadm - ipv4 + command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch host add {{ ansible_facts['hostname'] }} {{ ansible_facts['all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | first }} {{ group_names | join(' ') }} {{ '_admin' if mon_group_name | default('mons') in group_names else '' }}" changed_when: false delegate_to: '{{ groups[mon_group_name][0] }}' environment: CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' + when: ip_version == 'ipv4' + + - name: manage nodes with cephadm - ipv6 + command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch host add {{ ansible_facts['hostname'] }} {{ ansible_facts['all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ipwrap }} {{ group_names | join(' ') }} {{ '_admin' if mon_group_name | default('mons') in group_names else '' }}" + changed_when: false + delegate_to: '{{ groups[mon_group_name][0] }}' + environment: + CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' + when: ip_version == 'ipv6' - name: add ceph label for core component command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch host label add {{ ansible_facts['hostname'] }} ceph"