Improve inventory scoping for limited play execution

When executing the playbook with limits set, the scoping
currently does not work quite as well as one would hope.

This tightens it a bit more to ensure that it operates
as expected.

Change-Id: I8ebd42bcdf9676fd580955256498bbd8801f1cbd
This commit is contained in:
Jesse Pretorius 2017-07-06 12:49:51 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 1bcd6d5812
commit 0524fa6a46
3 changed files with 4 additions and 4 deletions

View File

@ -71,7 +71,7 @@
when:
- "ansible_local['openstack_ansible']['neutron']['need_db_contract'] | bool"
- "neutron_services['neutron-server']['group'] in group_names"
- "inventory_hostname == ansible_play_hosts[0]"
- "inventory_hostname == (groups[neutron_services['neutron-server']['group']] | intersect(ansible_play_hosts))[0]"
listen: "Restart neutron services"
- name: Start services

View File

@ -96,7 +96,7 @@
static: no
when:
- "neutron_services['neutron-server']['group'] in group_names"
- "inventory_hostname == ansible_play_hosts[0]"
- "inventory_hostname == (groups[neutron_services['neutron-server']['group']] | intersect(ansible_play_hosts))[0]"
tags:
- neutron-config

View File

@ -19,7 +19,7 @@
become_user: "{{ neutron_system_user_name }}"
when:
- "ansible_local['openstack_ansible']['neutron']['need_db_expand'] | bool"
- "inventory_hostname == ansible_play_hosts[0]"
- "inventory_hostname == (groups[neutron_services['neutron-server']['group']] | intersect(ansible_play_hosts))[0]"
- name: Disable the db expand fact
ini_file:
@ -33,7 +33,7 @@
become: yes
become_user: "{{ neutron_system_user_name }}"
when:
- "inventory_hostname == ansible_play_hosts[0]"
- "inventory_hostname == (groups[neutron_services['neutron-server']['group']] | intersect(ansible_play_hosts))[0]"
changed_when: false
register: _offline_migrations_check
failed_when: