From 7a12b854c47c37dbff21ce36af5bc5adc4eda68b Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 26 Oct 2021 09:04:21 +0200 Subject: [PATCH] cephadm: use public_network when adding host When adding host, using `ansible_facts['default_ipv4']['address']` might not be the desired network, we shouldn't enforce the subnet with the default route. Let's use the public_network instead. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2006415 Signed-off-by: Guillaume Abrioux --- infrastructure-playbooks/cephadm-adopt.yml | 6 +++++- infrastructure-playbooks/cephadm.yml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/infrastructure-playbooks/cephadm-adopt.yml b/infrastructure-playbooks/cephadm-adopt.yml index 23556245c..8553d8691 100644 --- a/infrastructure-playbooks/cephadm-adopt.yml +++ b/infrastructure-playbooks/cephadm-adopt.yml @@ -127,6 +127,10 @@ - not containerized_deployment | bool - ceph_docker_registry_auth | bool + - import_role: + name: ceph-facts + tasks_from: set_monitor_address.yml + - name: "pulling {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} image" command: "{{ timeout_command }} {{ container_binary }} pull {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}" changed_when: false @@ -296,7 +300,7 @@ when: is_hci | bool - name: manage nodes with cephadm - command: "{{ ceph_cmd }} orch host add {{ ansible_facts['nodename'] }} {{ ansible_facts['default_ipv4']['address'] }} {{ group_names | join(' ') }}" + command: "{{ ceph_cmd }} orch host add {{ ansible_facts['nodename'] }} {{ _current_monitor_address }} {{ group_names | join(' ') }}" changed_when: false delegate_to: '{{ groups[mon_group_name][0] }}' diff --git a/infrastructure-playbooks/cephadm.yml b/infrastructure-playbooks/cephadm.yml index 7456e4c95..b980fd7ef 100644 --- a/infrastructure-playbooks/cephadm.yml +++ b/infrastructure-playbooks/cephadm.yml @@ -220,6 +220,10 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts + tasks_from: set_monitor_address.yml + - name: get the cephadm ssh pub key command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} cephadm get-pub-key" changed_when: false @@ -241,7 +245,7 @@ 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 '' }}" + command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch host add {{ ansible_facts['hostname'] }} {{ _current_monitor_address }} {{ 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: -- 2.39.5