-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
playbook crash with md-cli config #19
Comments
Hello @nkhambal, Did you resolve this problem already? The syntax your using isn't the same as in the Nokia MD-CLI sample as linked above your using: vs the sample: |
@nkhambal, the |
Following playbook worked with one exception of "commit" tag. It commits even when it is set to "No". Is there an option to perform a commit "validate" and then "rollback" without actually committing the configuration?
|
Replying the answer to my own query. To skip commit and discard candidate after validate, use "commit: False". Default is "commit: True". Following playbook worked. It fetches the template and generates the configuration (deleting mpls lsp configuration in this case) and pushes it via cli_config. Does compare, validate and then discards the configuration providing the diff. NOTE: make sure you use "delete configure router" and not just "delete router" in the template. Later works with "configure private" but not "edit-config private" which is what the module uses to configure the device.
|
Running this playbook leads to the crash. It looks like module cli_config is trying to run 'show system information' command from "configure private" mode. The correct syntax should be "/show system information". How do we fix that? The error is coming from capabilities code. When I comment out the code at ansible/netcommon/plugins/modules/cli_config.py", line 414 that gathers the capabilities, the playbook runs fine but the configuration is not getting applied. Config I am trying to push is simple port description in MD-CLI
/configure port 1/1/c5 description "TEST-P2-TO-XXXXXX-BB-CR2|1/1/C5|AE1|-|-|BB"
/configure port 1/1/c5/1 description "TEST-P2-TO-XXXXXX-BB-CR2|1/1/C5|AE1|-|-|BB"
/configure port 1/1/c6 description "TEST-P2-TO-XXXXXX-BB-CR2|1/1/C6|AE1|-|-|BB"
/configure port 1/1/c6/1 description "TEST-P2-TO-XXXXXX-BB-CR2|1/1/C6|AE1|-|-|BB"
Running this directly on the router gives the same error
[pr:configure]
A:user@hostname# show system information
^^^^
MINOR: MGMT_CORE #2201: Unknown element - 'show'
[pr:configure]
A:user@hostname#
`---
name: Configure Nokia Router.
hosts: nokia-hosts
vars:
connection: network_cli
gather_facts: No
collections:
vars_files:
tasks:
name: switch to configure private mode
cli_command:
command: configure private
name: Fetch Configuration from File and apply it
cli_config:
config: "{{ lookup('file', devfilename)}}"
commit: Yes
vars:
devfilename: "{{ inventory_hostname }}.set"
register: configResult
name: Print Results
debug:
msg: |
{{ configResult }}`
Here is the traceback
`The full traceback is:
Traceback (most recent call last):
File "/Users/nileshkhambal/.ansible/tmp/ansible-local-543012zf14w03/ansible-tmp-1636584763.1242611-54331-33671898253459/AnsiballZ_cli_config.py", line 102, in
_ansiballz_main()
File "/Users/nileshkhambal/.ansible/tmp/ansible-local-543012zf14w03/ansible-tmp-1636584763.1242611-54331-33671898253459/AnsiballZ_cli_config.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/Users/nileshkhambal/.ansible/tmp/ansible-local-543012zf14w03/ansible-tmp-1636584763.1242611-54331-33671898253459/AnsiballZ_cli_config.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible_collections.ansible.netcommon.plugins.modules.cli_config', init_globals=None, run_name='main', alter_sys=True)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 207, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/var/folders/1l/0fnzwtp91w7_hr34_7qtd55r0000gn/T/ansible_cli_config_payload_jtfni_53/ansible_cli_config_payload.zip/ansible_collections/ansible/netcommon/plugins/modules/cli_config.py", line 461, in
File "/var/folders/1l/0fnzwtp91w7_hr34_7qtd55r0000gn/T/ansible_cli_config_payload_jtfni_53/ansible_cli_config_payload.zip/ansible_collections/ansible/netcommon/plugins/modules/cli_config.py", line 414, in main
File "/var/folders/1l/0fnzwtp91w7_hr34_7qtd55r0000gn/T/ansible_cli_config_payload_jtfni_53/ansible_cli_config_payload.zip/ansible/module_utils/connection.py", line 195, in rpc
ansible.module_utils.connection.ConnectionError: show system information
^^^^
MINOR: MGMT_CORE #2201: Unknown element - 'show'
[pr:configure]
A:user@xxxxxx-bb-cr1#
fatal: [xxxxxx-bb-cr1]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File "/Users/nileshkhambal/.ansible/tmp/ansible-local-543012zf14w03/ansible-tmp-1636584763.1242611-54331-33671898253459/AnsiballZ_cli_config.py", line 102, in \n _ansiballz_main()\n File "/Users/nileshkhambal/.ansible/tmp/ansible-local-543012zf14w03/ansible-tmp-1636584763.1242611-54331-33671898253459/AnsiballZ_cli_config.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/Users/nileshkhambal/.ansible/tmp/ansible-local-543012zf14w03/ansible-tmp-1636584763.1242611-54331-33671898253459/AnsiballZ_cli_config.py", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.ansible.netcommon.plugins.modules.cli_config', init_globals=None, run_name='main', alter_sys=True)\n File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code\n exec(code, run_globals)\n File "/var/folders/1l/0fnzwtp91w7_hr34_7qtd55r0000gn/T/ansible_cli_config_payload_jtfni_53/ansible_cli_config_payload.zip/ansible_collections/ansible/netcommon/plugins/modules/cli_config.py", line 461, in \n File "/var/folders/1l/0fnzwtp91w7_hr34_7qtd55r0000gn/T/ansible_cli_config_payload_jtfni_53/ansible_cli_config_payload.zip/ansible_collections/ansible/netcommon/plugins/modules/cli_config.py", line 414, in main\n File "/var/folders/1l/0fnzwtp91w7_hr34_7qtd55r0000gn/T/ansible_cli_config_payload_jtfni_53/ansible_cli_config_payload.zip/ansible/module_utils/connection.py", line 195, in rpc\nansible.module_utils.connection.ConnectionError: show system information\r\n ^^^^\r\nMINOR: MGMT_CORE #2201: Unknown element - 'show'\r\n\r\n[pr:configure]\r\nA:user@xxxxxx-bb-cr1# \n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}`
(myansible) ~/Documents/Work/NOKIA_Rollout/JPOSA3/lspconfig/remote/nokia: $ ansible --version
ansible 2.10.1
config file = None
configured module search path = ['/Users/nileshkhambal/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/nileshkhambal/Documents/myansible/lib/python3.8/site-packages/ansible
executable location = /Users/nileshkhambal/Documents/myansible/bin/ansible
python version = 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27) [Clang 6.0 (clang-600.0.57)]
(myansible) ~/Documents/Work/NOKIA_Rollout/JPOSA3/lspconfig/remote/nokia: $
The text was updated successfully, but these errors were encountered: