]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
cephadm: use public_network when adding host
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 26 Oct 2021 07:04:21 +0000 (09:04 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 26 Oct 2021 19:09:06 +0000 (21:09 +0200)
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 <gabrioux@redhat.com>
infrastructure-playbooks/cephadm-adopt.yml
infrastructure-playbooks/cephadm.yml

index 23556245cd6ebc190f036f8d59d2198a645fbf07..8553d8691d406821f735f6cd23db1634fcb3dd61 100644 (file)
         - 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
       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] }}'
 
index 7456e4c9532f52bc571262a7a28ca67752b3bbe1..b980fd7ef4d2364be0294f554d423183786e5827 100644 (file)
     - 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
         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: