]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
cephadm-adopt: fix orch host add with FQDN
authorDimitri Savineau <dsavinea@redhat.com>
Thu, 26 Aug 2021 16:06:11 +0000 (12:06 -0400)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Thu, 26 Aug 2021 19:50:32 +0000 (15:50 -0400)
When a node is configured with FQDN as the hostname value then the
`ceph orch host add` command will fail because the `ansible_hostname` used
by that command contains the short hostname which won't match the current
hostname (FQDN)
Instead we can use the ansible_nodename fact.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1997083
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
infrastructure-playbooks/cephadm-adopt.yml

index 6bd3311652f42743da886c0cf33c19d2594091be..0a63523fa49fc6f158782a3041ed62bb4b5211c4 100644 (file)
       when: is_hci | bool
 
     - name: manage nodes with cephadm
-      command: "{{ ceph_cmd }} orch host add {{ ansible_facts['hostname'] }} {{ ansible_facts['default_ipv4']['address'] }} {{ group_names | join(' ') }}"
+      command: "{{ ceph_cmd }} orch host add {{ ansible_facts['nodename'] }} {{ ansible_facts['default_ipv4']['address'] }} {{ group_names | join(' ') }}"
       changed_when: false
       delegate_to: '{{ groups[mon_group_name][0] }}'
 
     - name: add ceph label for core component
-      command: "{{ ceph_cmd }} orch host label add {{ ansible_facts['hostname'] }} ceph"
+      command: "{{ ceph_cmd }} orch host label add {{ ansible_facts['nodename'] }} ceph"
       changed_when: false
       delegate_to: '{{ groups[mon_group_name][0] }}'
       when: inventory_hostname in groups.get(mon_group_name, []) or
       command: >
         {{ cephadm_cmd }} shell --fsid {{ fsid }} --
         ceph --cluster {{ cluster }} orch apply rgw {{ ansible_facts['hostname'] }}
-        --placement='count-per-host:{{ radosgw_num_instances }} {{ ansible_facts['hostname'] }}'
+        --placement='count-per-host:{{ radosgw_num_instances }} {{ ansible_facts['nodename'] }}'
         --port={{ radosgw_frontend_port }}
         {{ '--ssl' if radosgw_frontend_ssl_certificate else '' }}
       changed_when: false
       command: >
         {{ cephadm_cmd }} shell --fsid {{ fsid }} --
         ceph --cluster {{ cluster }} orch apply rgw {{ ansible_facts['hostname'] }}.{{ item.rgw_realm }}.{{ item.rgw_zone }}.{{ item.radosgw_frontend_port }}
-        --placement={{ ansible_facts['hostname'] }}
+        --placement={{ ansible_facts['nodename'] }}
         --realm={{ item.rgw_realm }} --zone={{ item.rgw_zone }}
         --port={{ item.radosgw_frontend_port }}
         {{ '--ssl' if radosgw_frontend_ssl_certificate else '' }}