Description
SUMMARY
When IOS XE Device is in maintenance mode the prompt is not identified correctly and all config fails
This fails using ansible.netcommon.cli_config and cisco.ios.ios_config
maybe issue in regex here?
cisco.ios/plugins/cliconf/ios.py
Line 628 in b6923ab
ISSUE TYPE
- Bug Report
COMPONENT NAME
cisco.ios.ios_config
ANSIBLE VERSION
ansible [core 2.14.1]
python version = 3.10.6 (main, Aug 30 2022, 05:12:36) [Clang 13.1.6 (clang-1316.0.21.2.5)] (/usr/local/opt/[email protected]/bin/python3.10)
jinja version = 3.1.2
libyaml = True
COLLECTION VERSION
# /Users/*/.ansible/collections/ansible_collections
Collection Version
------------------------ -------
ansible.netcommon 4.1.0
ansible.utils 2.7.0
ansible.windows 1.9.0
cisco.ios 4.0.0
cisco.iosxr 4.0.1
cisco.nxos 4.0.0
community.general 6.0.1
CONFIGURATION
default config
OS / ENVIRONMENT
Switch Ports Model SW Version SW Image Mode
------ ----- ----- ---------- ---------- ----
* 1 65 C9300-48P 17.06.03 CAT9K_IOSXE INSTALL
STEPS TO REPRODUCE
I just made 2 simple tasks to reproduce, but issue applies to any config
lab-leaf03#start maintenance
Template default will be applied. Do you want to continue?[confirm]
lab-leaf03(maint-mode)#
lab-leaf03(maint-mode)# << Prompt is now changed
lab-leaf03(maint-mod(config)# < Config prompt is this now
After maintenance mode is stopped everything runs as intended
- name: test stuff
ignore_errors: yes
cisco.ios.ios_config:
config:
- hostname lab-leaf03
- name: test stuff
ansible.netcommon.cli_config:
config:
- hostname lab-leaf03
EXPECTED RESULTS
Able to configure things on device while in maintenance mode
ACTUAL RESULTS
It does not determine correctly which prompt it is in. Instead in enable mode it tries to run end twice to get out. Looks like some regex is not correct somewhere.
TASK [test stuff] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /workspace/ansible-prod/graceful-insert.yml:12
The full traceback is:
File ".ansible/collections/ansible_collections/cisco/ios/plugins/module_utils/network/ios/ios.py", line 61, in get_capabilities
capabilities = Connection(module._socket_path).get_capabilities()
File "/usr/local/lib/python3.10/site-packages/ansible/module_utils/connection.py", line 200, in __rpc__
raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [lab-leaf03]: FAILED! => changed=false
invocation:
module_args:
after: null
backup: false
backup_options: null
before: null
config:
- hostname lab-leaf03
defaults: false
diff_against: null
diff_ignore_lines: null
intended_config: null
lines: null
match: line
multiline_delimiter: '@'
parents: null
replace: line
running_config: '[''hostname lab-leaf03'']'
save_when: never
src: null
msg: |-
end
end
^
% Invalid input detected at '^' marker.
lab-leaf03(maint-mode)#