From 823ced910a194136c9dccf22a842febca6f7cd18 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 6 Jul 2017 12:58:58 +0100 Subject: [PATCH] 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: I1122196cf125f8f993a3c72e7c3767cd7fb3549d --- tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index fdb2a9a8..98c06579 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -55,7 +55,7 @@ when: - "groups['cinder_api'] | length > 0" - "'cinder_api' in group_names" - - "inventory_hostname == ansible_play_hosts[0]" + - "inventory_hostname == (groups['cinder_api'] | intersect(ansible_play_hosts))[0]" tags: - cinder-config @@ -64,7 +64,7 @@ when: - "groups['cinder_api'] | length > 0" - "'cinder_api' in group_names" - - "inventory_hostname == ansible_play_hosts[0]" + - "inventory_hostname == (groups['cinder_api'] | intersect(ansible_play_hosts))[0]" tags: - cinder-config @@ -80,7 +80,7 @@ when: - "groups['cinder_volume'] | length > 0" - "'cinder_volume' in group_names" - - "inventory_hostname == ansible_play_hosts[0]" + - "inventory_hostname == (groups['cinder_volume'] | intersect(ansible_play_hosts))[0]" tags: - cinder-config