Search code examples
ansiblecisco-ios

Cisco ansible show running-config


As per documentation, this should fetch the running config by running show running-config all

      cisco.ios.ios_config:
        defaults: yes

It ends up erroring out with

"msg": "show running-config ?\\r\\n% Unrecognized command\\r\\nRTCISCO1111>show running-config \\r\\nshow running-config \\r\\n      ^\\r\\n% Invalid input detected at '^' marker.\\r\\n\\r\\nRTCISCO1111>"
} 

I traced the command show running-config ? to https://github.com/ansible-collections/cisco.ios/blob/main/plugins/cliconf/ios.py#L455 In this part of the code I do not understand why its not substituting ? with all. Do I need to supply some additional commands? I cannot run show running-config all as shell command because it required root access on device.


Solution

  • Cisco requires enable mode to run show running-config all command. Getting into enable mode requires another password.

    Some examples on how to use in playbook are here https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html