add-osd: fix fact gathering in add-osd

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>
pull/5267/head
Guillaume Abrioux 2020-04-07 14:57:47 +02:00 committed by Dimitri Savineau
parent 8ccf91c1f0
commit 724620ed3d
1 changed files with 3 additions and 20 deletions

View 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
@ -77,12 +73,6 @@
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
@ -94,10 +84,3 @@
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