From 4ec2423a049551733f0f6a5d7be5202eb4a02d27 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 6 Nov 2018 13:19:44 -0500 Subject: [PATCH] make fact gathering obey play tags (#44717) fixes #44251 --- changelogs/fragments/tag_gathering.yml | 2 ++ lib/ansible/executor/play_iterator.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/tag_gathering.yml diff --git a/changelogs/fragments/tag_gathering.yml b/changelogs/fragments/tag_gathering.yml new file mode 100644 index 0000000000..2999b9288b --- /dev/null +++ b/changelogs/fragments/tag_gathering.yml @@ -0,0 +1,2 @@ +bugfixes: + - fact gathering to obey play tags diff --git a/lib/ansible/executor/play_iterator.py b/lib/ansible/executor/play_iterator.py index 46c25496a1..289bb867ec 100644 --- a/lib/ansible/executor/play_iterator.py +++ b/lib/ansible/executor/play_iterator.py @@ -175,10 +175,14 @@ class PlayIterator: setup_task = Task(block=setup_block) setup_task.action = 'setup' setup_task.name = 'Gathering Facts' - setup_task.tags = ['always'] setup_task.args = { 'gather_subset': gather_subset, } + + # Unless play is specifically tagged, gathering should 'always' run + if self._play.tags is None: + setup_task.tags = ['always'] + if gather_timeout: setup_task.args['gather_timeout'] = gather_timeout if fact_path: