]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
defaults: play set_radosgw_address.yml only on rgw nodes
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 22 Nov 2018 13:38:57 +0000 (14:38 +0100)
committermergify[bot] <mergify[bot]@users.noreply.github.com>
Tue, 27 Nov 2018 16:47:40 +0000 (16:47 +0000)
This is not needed to play these tasks on nodes that are not in rgw
group.

Always playing this code makes `shrink_mon.yml` failing.

Typical error:

```
TASK [ceph-defaults : set_fact _radosgw_address to radosgw_interface - ipv4] ***
task path: /home/jenkins-build/build/workspace/ceph-ansible-prs-dev-shrink_mon/roles/ceph-defaults/tasks/set_radosgw_address.yml:21
Thursday 22 November 2018  12:34:51 +0000 (0:00:00.154)       0:00:12.371 *****
fatal: [localhost]: FAILED! => {}

MSG:

The task includes an option with an undefined variable. The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute u'ansible_eth1'
```

Indeed, `radosgw_interface` is the network interface on rgw only. It is
expected that this same interface doesn't exist on `localhost`, so, when
running `shrink_mon.yml`, the role `ceph-defaults` is called in
`hosts: localhost` and causes the playbook to fail.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-defaults/tasks/facts.yml

index c2e905f0c4d150cf6d3a63df282340939f7f8d59..4404e4ba8cfd27b66dceded433124f76526ef553 100644 (file)
 
 - name: import_tasks set_radosgw_address.yml
   import_tasks: set_radosgw_address.yml
+  when:
+    - inventory_hostname in groups.get(rgw_group_name, [])
 
 - name: populate service facts
   service_facts: