diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index 39921896e5f..e6c660f1dbe 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -178,6 +178,7 @@ _ACTION_INCLUDE_TASKS = add_internal_fqcns(('include_tasks', )) _ACTION_INCLUDE_VARS = add_internal_fqcns(('include_vars', )) _ACTION_META = add_internal_fqcns(('meta', )) _ACTION_SET_FACT = add_internal_fqcns(('set_fact', )) +_ACTION_SETUP = add_internal_fqcns(('setup', )) _ACTION_HAS_CMD = add_internal_fqcns(('command', 'shell', 'script')) _ACTION_ALLOWS_RAW_ARGS = _ACTION_HAS_CMD + add_internal_fqcns(('raw', )) _ACTION_ALL_INCLUDES = _ACTION_INCLUDE + _ACTION_INCLUDE_TASKS + _ACTION_INCLUDE_ROLE @@ -187,5 +188,5 @@ _ACTION_ALL_PROPER_INCLUDE_IMPORT_ROLES = _ACTION_INCLUDE_ROLE + _ACTION_IMPORT_ _ACTION_ALL_PROPER_INCLUDE_IMPORT_TASKS = _ACTION_INCLUDE_TASKS + _ACTION_IMPORT_TASKS _ACTION_ALL_INCLUDE_ROLE_TASKS = _ACTION_INCLUDE_ROLE + _ACTION_INCLUDE_TASKS _ACTION_ALL_INCLUDE_TASKS = _ACTION_INCLUDE + _ACTION_INCLUDE_TASKS -_ACTION_FACT_GATHERING = add_internal_fqcns(('setup', 'gather_facts')) +_ACTION_FACT_GATHERING = _ACTION_SETUP + add_internal_fqcns(('gather_facts', )) _ACTION_WITH_CLEAN_FACTS = _ACTION_SET_FACT + _ACTION_INCLUDE_VARS diff --git a/lib/ansible/plugins/action/gather_facts.py b/lib/ansible/plugins/action/gather_facts.py index 4276c090b9d..eac63e17365 100644 --- a/lib/ansible/plugins/action/gather_facts.py +++ b/lib/ansible/plugins/action/gather_facts.py @@ -21,7 +21,7 @@ class ActionModule(ActionBase): mod_args = self._task.args.copy() # deal with 'setup specific arguments' - if fact_module not in ['ansible.legacy.setup', 'ansible.builtin.setup', 'setup']: + if fact_module not in C._ACTION_SETUP: # network facts modules must support gather_subset if self._connection._load_name not in ('network_cli', 'httpapi', 'netconf'): subset = mod_args.pop('gather_subset', None) diff --git a/lib/ansible/plugins/action/normal.py b/lib/ansible/plugins/action/normal.py index 1582c8619e1..cb91521ac5a 100644 --- a/lib/ansible/plugins/action/normal.py +++ b/lib/ansible/plugins/action/normal.py @@ -17,6 +17,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type +from ansible import constants as C from ansible.plugins.action import ActionBase from ansible.utils.vars import merge_hash @@ -48,7 +49,7 @@ class ActionModule(ActionBase): # hack to keep --verbose from showing all the setup module result # moved from setup module as now we filter out all _ansible_ from result # FIXME: is this still accurate with gather_facts etc, or does it need support for FQ and other names? - if self._task.action == 'setup': + if self._task.action in C._ACTION_SETUP: result['_ansible_verbose_override'] = True if not wrap_async: diff --git a/lib/ansible/plugins/callback/junit.py b/lib/ansible/plugins/callback/junit.py index 97f0cfd1206..8bd1ed6ad25 100644 --- a/lib/ansible/plugins/callback/junit.py +++ b/lib/ansible/plugins/callback/junit.py @@ -81,6 +81,7 @@ import os import time import re +from ansible import constants as C from ansible.module_utils._text import to_bytes, to_text from ansible.plugins.callback import CallbackBase @@ -290,7 +291,7 @@ class CallbackModule(CallbackBase): test_cases = [] for task_uuid, task_data in self._task_data.items(): - if task_data.action == 'setup' and self._include_setup_tasks_in_report == 'false': + if task_data.action in C._ACTION_SETUP and self._include_setup_tasks_in_report == 'false': continue for host_uuid, host_data in task_data.host_data.items(): diff --git a/lib/ansible/plugins/strategy/__init__.py b/lib/ansible/plugins/strategy/__init__.py index 6f35e2f8b6d..278825dd15e 100644 --- a/lib/ansible/plugins/strategy/__init__.py +++ b/lib/ansible/plugins/strategy/__init__.py @@ -743,7 +743,7 @@ class StrategyBase: # If this is a role task, mark the parent role as being run (if # the task was ok or failed, but not skipped or unreachable) - if original_task._role is not None and role_ran: # TODO: and original_task.action != 'include_role':? + if original_task._role is not None and role_ran: # TODO: and original_task.action not in C._ACTION_INCLUDE_ROLE:? # lookup the role in the ROLE_CACHE to make sure we're dealing # with the correct object and mark it as executed for (entry, role_obj) in iteritems(iterator._play.ROLE_CACHE[original_task._role.get_name()]):