take-over: fix bug when trying to override variable

A customer has been facing an issue when trying to override
`monitor_interface` in inventory host file.
In his use case, all nodes had the same interface for
`monitor_interface` name except one. Therefore, they tried to override
this variable for that node in the inventory host file but the
take-over-existing-cluster playbook was failing when trying to generate
the new ceph.conf file because of undefined variable.

Typical error:

```
fatal: [srvcto103cnodep01]: FAILED! => {"failed": true, "msg": "'dict object' has no attribute u'ansible_bond0.15'"}
```

Including variables like this `include_vars: group_vars/all.yml` prevent
us from overriding anything in inventory host file because it
overwrites everything you would have defined in inventory.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1575915

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/2619/head
Guillaume Abrioux 2018-05-17 17:29:20 +02:00 committed by Sébastien Han
parent fa8e2e7522
commit 415dc0a29b
1 changed files with 3 additions and 3 deletions

View File

@ -34,10 +34,10 @@
- iscsi-gw - iscsi-gw
become: true become: true
tasks: roles:
- include_vars: roles/ceph-defaults/defaults/main.yml - ceph-defaults
- include_vars: group_vars/all.yml
post_tasks:
- name: get the name of the existing ceph cluster - name: get the name of the existing ceph cluster
shell: | shell: |
basename $(grep --exclude '*.bak' -R fsid /etc/ceph/ | egrep -o '^[^.]*' | head -n 1) basename $(grep --exclude '*.bak' -R fsid /etc/ceph/ | egrep -o '^[^.]*' | head -n 1)