diff --git a/examples/ansible.cfg b/examples/ansible.cfg index 40126ee91a..109f508002 100644 --- a/examples/ansible.cfg +++ b/examples/ansible.cfg @@ -284,6 +284,10 @@ # possibly multiple sources (both static and dynamic) #inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo +# This family of modules use an alternative execution path optimized for network appliances +# only update this setting if you know how this works, otherwise it can break module execution +#network_group_modules=['eos', 'nxos', 'ios', 'iosxr', 'junos', 'vyos'] + [privilege_escalation] #become=True #become_method=sudo diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index 6a2c1c8953..6116fae27c 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -299,6 +299,8 @@ DEFAULT_FILTER_PLUGIN_PATH = get_config(p, DEFAULTS, 'filter_plugins', ' DEFAULT_TEST_PLUGIN_PATH = get_config(p, DEFAULTS, 'test_plugins', 'ANSIBLE_TEST_PLUGINS', '~/.ansible/plugins/test:/usr/share/ansible/plugins/test', value_type='pathlist') DEFAULT_STRATEGY_PLUGIN_PATH = get_config(p, DEFAULTS, 'strategy_plugins', 'ANSIBLE_STRATEGY_PLUGINS', '~/.ansible/plugins/strategy:/usr/share/ansible/plugins/strategy', value_type='pathlist') +NETWORK_GROUP_MODULES = get_config(p, DEFAULTS, 'network_group_modules','NETWORK_GROUP_MODULES', ['eos', 'nxos', 'ios', 'iosxr', 'junos', 'vyos'], value_type='list') + DEFAULT_STRATEGY = get_config(p, DEFAULTS, 'strategy', 'ANSIBLE_STRATEGY', 'linear') DEFAULT_STDOUT_CALLBACK = get_config(p, DEFAULTS, 'stdout_callback', 'ANSIBLE_STDOUT_CALLBACK', 'default') # cache diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index ce65ea8497..c2c87ef5a8 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -774,13 +774,12 @@ class TaskExecutor: Returns the correct action plugin to handle the requestion task action ''' - network_group_modules = frozenset(['eos', 'nxos', 'ios', 'iosxr', 'junos', 'vyos']) module_prefix = self._task.action.split('_')[0] # let action plugin override module, fallback to 'normal' action plugin otherwise if self._task.action in self._shared_loader_obj.action_loader: handler_name = self._task.action - elif all((module_prefix in network_group_modules, module_prefix in self._shared_loader_obj.action_loader)): + elif all((module_prefix in C.NETWORK_GROUP_MODULES, module_prefix in self._shared_loader_obj.action_loader)): handler_name = module_prefix else: handler_name = 'normal'