diff --git a/changelogs/fragments/tag_gathering.yml b/changelogs/fragments/tag_gathering.yml new file mode 100644 index 00000000000..2999b9288bc --- /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 46c25496a1f..289bb867ec9 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: