diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index f9c8043489..f43e2a88dd 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -1605,7 +1605,7 @@ MAX_FILE_SIZE_FOR_DIFF: type: int NETWORK_GROUP_MODULES: name: Network module families - default: [eos, nxos, ios, iosxr, junos, enos, ce, vyos, sros, dellos9, dellos10, dellos6, asa, aruba, aireos, bigip, ironware, onyx, netconf] + default: [eos, nxos, ios, iosxr, junos, enos, ce, vyos, sros, dellos9, dellos10, dellos6, asa, aruba, aireos, bigip, ironware, onyx, netconf, exos, voss, slxos] description: 'TODO: write it' env: - name: NETWORK_GROUP_MODULES diff --git a/lib/ansible/plugins/action/exos_lldp_global.py b/lib/ansible/plugins/action/exos.py similarity index 70% rename from lib/ansible/plugins/action/exos_lldp_global.py rename to lib/ansible/plugins/action/exos.py index 34a34c95d3..7dfebef78c 100644 --- a/lib/ansible/plugins/action/exos_lldp_global.py +++ b/lib/ansible/plugins/action/exos.py @@ -24,10 +24,20 @@ from ansible.plugins.action.network import ActionModule as ActionNetworkModule class ActionModule(ActionNetworkModule): + EXOS_NETWORK_CLI_MODULES = ( + 'exos_facts', + 'exos_config', + 'exos_command') + def run(self, tmp=None, task_vars=None): del tmp # tmp no longer has any effect - if self._play_context.connection != 'httpapi': + self._config_module = True if self._task.action == 'exos_config' else False + + if self._play_context.connection not in ('network_cli', 'httpapi'): + return {'failed': True, 'msg': 'Connection type %s is not valid for this module' % self._play_context.connection} + + if self._play_context.connection == 'network_cli' and self._task.action not in self.EXOS_NETWORK_CLI_MODULES: return {'failed': True, 'msg': "Connection type %s is not valid for this module" % self._play_context.connection} return super(ActionModule, self).run(task_vars=task_vars) diff --git a/lib/ansible/plugins/action/exos_config.py b/lib/ansible/plugins/action/exos_config.py deleted file mode 100644 index 7d3381232b..0000000000 --- a/lib/ansible/plugins/action/exos_config.py +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright 2015 Peter Sprygada -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible.plugins.action.network import ActionModule as ActionNetworkModule - - -class ActionModule(ActionNetworkModule): - - def run(self, tmp=None, task_vars=None): - del tmp # tmp no longer has any effect - - self._config_module = True - return super(ActionModule, self).run(task_vars=task_vars) diff --git a/lib/ansible/plugins/action/slxos_config.py b/lib/ansible/plugins/action/slxos.py similarity index 80% rename from lib/ansible/plugins/action/slxos_config.py rename to lib/ansible/plugins/action/slxos.py index 03104f5006..9259b6c3d6 100644 --- a/lib/ansible/plugins/action/slxos_config.py +++ b/lib/ansible/plugins/action/slxos.py @@ -31,5 +31,7 @@ class ActionModule(ActionNetworkModule): def run(self, tmp=None, task_vars=None): del tmp # tmp no longer has any effect - self._config_module = True + self._config_module = True if self._task.action == 'slxos_config' else False + if self._play_context.connection not in ('network_cli'): + return {'failed': True, 'msg': 'Connection type %s is not valid for this module' % self._play_context.connection} return super(ActionModule, self).run(task_vars=task_vars) diff --git a/lib/ansible/plugins/action/voss_config.py b/lib/ansible/plugins/action/voss.py similarity index 79% rename from lib/ansible/plugins/action/voss_config.py rename to lib/ansible/plugins/action/voss.py index 80ffdcbc56..562b8734d6 100644 --- a/lib/ansible/plugins/action/voss_config.py +++ b/lib/ansible/plugins/action/voss.py @@ -27,5 +27,7 @@ class ActionModule(ActionNetworkModule): def run(self, tmp=None, task_vars=None): del tmp # tmp no longer has any effect - self._config_module = True + self._config_module = True if self._task.action == 'voss_config' else False + if self._play_context.connection not in ('network_cli'): + return {'failed': True, 'msg': 'Connection type %s is not valid for this module' % self._play_context.connection} return super(ActionModule, self).run(task_vars=task_vars) diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index dbcd24c718..2978f07612 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -5667,6 +5667,9 @@ lib/ansible/plugins/action/normal.py action-plugin-docs # default action plugin lib/ansible/plugins/action/nxos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` lib/ansible/plugins/action/sros.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` lib/ansible/plugins/action/vyos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` +lib/ansible/plugins/action/exos.py action-plugin-docs # undocumented action plugin to fix +lib/ansible/plugins/action/slxos.py action-plugin-docs # undocumented action plugin to fix +lib/ansible/plugins/action/voss.py action-plugin-docs # undocumented action plugin to fix lib/ansible/plugins/cache/base.py ansible-doc!skip # not a plugin, but a stub for backwards compatibility lib/ansible/plugins/callback/hipchat.py pylint:blacklisted-name lib/ansible/plugins/connection/lxc.py pylint:blacklisted-name