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
This commit is contained in:
Chen 2017-05-16 16:51:29 +09:00
parent dc5e05d8a2
commit d366dd7e4a

View File

@ -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