From d366dd7e4a0002a2e170dbbda1107f61807323e5 Mon Sep 17 00:00:00 2001 From: Chen Date: Tue, 16 May 2017 16:51:29 +0900 Subject: [PATCH] Avoid facts gathered twice when deploying with --limit When deploying with argument --limit, both first and second plays in site.yml will be processed, causing host facts gathered twice, which is unnecessary. Thus a condition is added to the first play to avoid such redundancy. Change-Id: I20b84c59bf73aaeca929fc56465ff2cf1cf52b8e Closes-Bug: #1691033 --- ansible/site.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ansible/site.yml b/ansible/site.yml index 77d3f2905c..ec2d43156b 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -10,8 +10,9 @@ gather_facts: false tasks: - setup: - tags: always - + when: + - (play_hosts | length) == (groups['all'] | length) + # NOTE(pbourke): This case covers deploying subsets of hosts using --limit. The # limit arg will cause the first play to gather facts only about that node, # meaning facts such as IP addresses for rabbitmq nodes etc. will be undefined