Skip to content
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

Interface range command causes a traceback #1100

Open
gtom84 opened this issue Jul 16, 2024 · 0 comments
Open

Interface range command causes a traceback #1100

gtom84 opened this issue Jul 16, 2024 · 0 comments

Comments

@gtom84
Copy link

gtom84 commented Jul 16, 2024

SUMMARY

ios_config module accepts format

interface range Gi0/1 - 2

but this valid IOS syntax causes traceback

interface range Gi0/1, Gi0/2

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ios_config

ANSIBLE VERSION
ansible [core 2.15.8]
  config file = /usr/local/xx/ansible/ansible.cfg
  configured module search path = ['/home/xx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /venv/ansible/lib/python3.9/site-packages/ansible
  ansible collection location = /usr/local/xx/ansible/collections
  executable location = /venv/ansible/bin/ansible
  python version = 3.9.5 (default, Nov 23 2021, 15:27:38) [GCC 9.3.0] (/venv/ansible/bin/python3.9)
  jinja version = 3.1.3
  libyaml = True

COLLECTION VERSION
# /usr/local/xx/ansible/collections/ansible_collections
Collection Version
---------- -------
cisco.ios  9.0.0

# /venv/ansible/lib/python3.9/site-packages/ansible_collections
Collection Version
---------- -------
cisco.ios  4.6.1
CONFIGURATION
ANSIBLE_NOCOWS(/usr/local/xx/ansible/ansible.cfg) = True
CACHE_PLUGIN(/usr/local/xx/ansible/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/usr/local/xx/ansible/ansible.cfg) = /usr/local/xx/ansible/cache
COLLECTIONS_PATHS(/usr/local/xx/ansible/ansible.cfg) = ['/usr/local/xx/ansible/collections']
CONFIG_FILE() = /usr/local/xx/ansible/ansible.cfg
DEFAULT_HOST_LIST(/usr/local/xx/ansible/ansible.cfg) = ['/usr/local/xx/ansible/hosts']
DEFAULT_REMOTE_USER(/usr/local/xx/ansible/ansible.cfg) = ansdeploy
DEFAULT_ROLES_PATH(/usr/local/xx/ansible/ansible.cfg) = ['/usr/local/xx/ansible/roles']
HOST_KEY_CHECKING(/usr/local/xx/ansible/ansible.cfg) = False
INTERPRETER_PYTHON(/usr/local/xx/ansible/ansible.cfg) = auto
OS / ENVIRONMENT
STEPS TO REPRODUCE
---
- hosts: your_hosts
  gather_facts: false
  tasks:
      - name: Default interfaces config
        ios_config:
          lines:
            - default int range Gi0/1, Gi0/2
      - name: Configure interfaces
        ios_config:
          lines:
            - description New description
          parents: "interface range Gi0/1, Gi0/2"
EXPECTED RESULTS

The above should not cause any traceback.

ACTUAL RESULTS

The full traceback is:
Traceback (most recent call last):
  File "/home/xx/.ansible/tmp/ansible-local-174914kI5Nq/ansible-tmp-1721118244.83-17567-217273740546307/AnsiballZ_ios_config.py", line 102, in <module>
    _ansiballz_main()
  File "/home/xx/.ansible/tmp/ansible-local-174914kI5Nq/ansible-tmp-1721118244.83-17567-217273740546307/AnsiballZ_ios_config.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/xx/.ansible/tmp/ansible-local-174914kI5Nq/ansible-tmp-1721118244.83-17567-217273740546307/AnsiballZ_ios_config.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible.modules.network.ios.ios_config', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib64/python2.7/runpy.py", line 176, in run_module
    fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/tmp/ansible_ios_config_payload_bRAH6H/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 569, in <module>
  File "/tmp/ansible_ios_config_payload_bRAH6H/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 500, in main
  File "/tmp/ansible_ios_config_payload_bRAH6H/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 364, in edit_config_or_macro
  File "/tmp/ansible_ios_config_payload_bRAH6H/ansible_ios_config_payload.zip/ansible/module_utils/connection.py", line 190, in __rpc__
ansible.module_utils.connection.ConnectionError: default int range Gi0/19, Gi0/20
default int range Gi0/19, Gi0/20
                       ^
% Invalid input detected at '^' marker.

SW02(config)#
fatal: [SW02]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/xx/.ansible/tmp/ansible-local-174914kI5Nq/ansible-tmp-1721118244.83-17567-217273740546307/AnsiballZ_ios_config.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/xx/.ansible/tmp/ansible-local-174914kI5Nq/ansible-tmp-1721118244.83-17567-217273740546307/AnsiballZ_ios_config.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/xx/.ansible/tmp/ansible-local-174914kI5Nq/ansible-tmp-1721118244.83-17567-217273740546307/AnsiballZ_ios_config.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.network.ios.ios_config', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module\n    fname, loader, pkg_name)\n  File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code\n    mod_name, mod_fname, mod_loader, pkg_name)\n  File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code\n    exec code in run_globals\n  File \"/tmp/ansible_ios_config_payload_bRAH6H/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py\", line 569, in <module>\n  File \"/tmp/ansible_ios_config_payload_bRAH6H/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py\", line 500, in main\n  File \"/tmp/ansible_ios_config_payload_bRAH6H/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py\", line 364, in edit_config_or_macro\n  File \"/tmp/ansible_ios_config_payload_bRAH6H/ansible_ios_config_payload.zip/ansible/module_utils/connection.py\", line 190, in __rpc__\nansible.module_utils.connection.ConnectionError: default int range Gi0/19, Gi0/20\r\ndefault int range Gi0/19, Gi0/20\r\n                       ^\r\n% Invalid input detected at '^' marker.\r\n\r\nmcigmy2-ostravank-29(config)#\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant