EXOS/VOSS/SLXOS - Single action file and 'gather_facts' (#61914)

* EXOS Single action file

* Single action file for all Extreme Network OSes
This commit is contained in:
Ujwal Komarla 2019-10-21 13:31:26 -04:00 committed by Nathaniel Case
parent 40975cd436
commit dc5770dfa2
6 changed files with 21 additions and 35 deletions

View file

@ -1605,7 +1605,7 @@ MAX_FILE_SIZE_FOR_DIFF:
type: int type: int
NETWORK_GROUP_MODULES: NETWORK_GROUP_MODULES:
name: Network module families 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' description: 'TODO: write it'
env: env:
- name: NETWORK_GROUP_MODULES - name: NETWORK_GROUP_MODULES

View file

@ -24,10 +24,20 @@ from ansible.plugins.action.network import ActionModule as ActionNetworkModule
class ActionModule(ActionNetworkModule): class ActionModule(ActionNetworkModule):
EXOS_NETWORK_CLI_MODULES = (
'exos_facts',
'exos_config',
'exos_command')
def run(self, tmp=None, task_vars=None): def run(self, tmp=None, task_vars=None):
del tmp # tmp no longer has any effect 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 {'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) return super(ActionModule, self).run(task_vars=task_vars)

View file

@ -1,31 +0,0 @@
#
# Copyright 2015 Peter Sprygada <psprygada@ansible.com>
#
# 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 <http://www.gnu.org/licenses/>.
#
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)

View file

@ -31,5 +31,7 @@ class ActionModule(ActionNetworkModule):
def run(self, tmp=None, task_vars=None): def run(self, tmp=None, task_vars=None):
del tmp # tmp no longer has any effect 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) return super(ActionModule, self).run(task_vars=task_vars)

View file

@ -27,5 +27,7 @@ class ActionModule(ActionNetworkModule):
def run(self, tmp=None, task_vars=None): def run(self, tmp=None, task_vars=None):
del tmp # tmp no longer has any effect 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) return super(ActionModule, self).run(task_vars=task_vars)

View file

@ -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/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/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/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/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/callback/hipchat.py pylint:blacklisted-name
lib/ansible/plugins/connection/lxc.py pylint:blacklisted-name lib/ansible/plugins/connection/lxc.py pylint:blacklisted-name