]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
add-osd: fix fact gathering in add-osd
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 7 Apr 2020 12:57:47 +0000 (14:57 +0200)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Tue, 7 Apr 2020 15:19:53 +0000 (11:19 -0400)
This commit makes this playbook gathering facts from all other nodes but
clients.
When collocating OSDs on other nodes it can fail like following:

```
fatal: [vm252-11]: FAILED! => {
    "msg": "'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_hostname'"
}
```

In that case, a fact from a RGW node is called when rendering the
`ceph.conf.j2` but it fails because facts are gathered only from mon and
osd nodes.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1806765
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
infrastructure-playbooks/add-osd.yml

index 7e2d8ff3cd798b2e837729687174f4be99cebe6e..4aa7bf6a127904f87cc352c08675af878adc3cb9 100644 (file)
@@ -35,9 +35,7 @@
       setup:
       delegate_to: "{{ item }}"
       delegate_facts: True
-      with_items:
-        - "{{ groups['mons'] }}"
-        - "{{ groups['osds'] }}"
+      with_items: "{{ groups['all'] | difference(groups.get('clients', [])) }}"
       run_once: True
       when:
         - delegate_facts_host | bool
@@ -65,9 +63,7 @@
       setup:
       delegate_to: "{{ item }}"
       delegate_facts: True
-      with_items:
-        - "{{ groups['mons'] }}"
-        - "{{ groups['osds'] }}"
+      with_items: "{{ groups['all'] | difference(groups.get('clients', [])) }}"
       run_once: True
       when:
         - delegate_facts_host | bool
       set_fact:
         add_osd: True
 
-    - name: set noup flag
-      command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd set noup"
-      delegate_to: "{{ groups['mons'][0] }}"
-      run_once: True
-      changed_when: False
-
   roles:
     - role: ceph-defaults
     - role: ceph-handler
     - role: ceph-common
       when: not containerized_deployment | bool
     - role: ceph-config
-    - role: ceph-osd
-
-  post_tasks:
-    - name: unset noup flag
-      command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd unset noup"
-      delegate_to: "{{ groups['mons'][0] }}"
-      run_once: True
-      changed_when: False
\ No newline at end of file
+    - role: ceph-osd
\ No newline at end of file