designate: Correctly match hostnames

'in' expresion matches substrings, therefore it is possible
that following expression will fail:
    inventory_hostname in groups['groupname'][0]
for example when:
    inventory_hostname = 'my-host-a'
    groups['groupname'][0] = 'my-host-a1'

The result is running task on multiple hosts rather than single one.
Such action might result in playbook failure

Change-Id: Ibe2d5ca2f9502a8140a895ab3ac7abc5076ce2ff
Signed-off-by: Maciej Kucia <m.kucia@partner.samsung.com>
This commit is contained in:
Maciej Kucia 2018-12-19 15:39:35 +01:00 committed by Maciej Kucia
parent 23c439db0a
commit 4a127d4bd9
2 changed files with 2 additions and 2 deletions

View File

@ -21,4 +21,4 @@
meta: flush_handlers
- include_tasks: update_pools.yml
when: inventory_hostname in groups['designate-worker'][0]
when: inventory_hostname == groups['designate-worker'][0]

View File

@ -1,4 +1,4 @@
---
- name: Update DNS pools
command: docker exec -t designate_worker designate-manage pool update --file /etc/designate/pools.yaml
when: inventory_hostname in groups['designate-worker'][0]
when: inventory_hostname == groups['designate-worker'][0]