mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
Added Ordnance Module (#21447)
* Added Ordnance network module. * Tidied up code base as per PR20436 * Whitespace blocking PEP8 test * Removed acciental addition to VERSION * Removed acciental addition to VERSION * Documentation YAML issues * removed force arg (depreciated) * rectified broken import * Ordnance module init * added ordnance helper
This commit is contained in:
parent
53ac312382
commit
dc5d92eac2
4 changed files with 691 additions and 0 deletions
16
lib/ansible/module_utils/ordnance.py
Normal file
16
lib/ansible/module_utils/ordnance.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
_DEVICE_CONFIGS = {}
|
||||
|
||||
def get_config(module, flags=[]):
|
||||
cmd = 'show running-config '
|
||||
cmd += ' '.join(flags)
|
||||
cmd = cmd.strip()
|
||||
|
||||
try:
|
||||
return _DEVICE_CONFIGS[cmd]
|
||||
except KeyError:
|
||||
rc, out, err = module.exec_command(cmd)
|
||||
if rc != 0:
|
||||
module.fail_json(msg='unable to retrieve current config', stderr=err)
|
||||
cfg = str(out).strip()
|
||||
_DEVICE_CONFIGS[cmd] = cfg
|
||||
return cfg
|
Loading…
Add table
Add a link
Reference in a new issue