I ended up running the following manually. I just need a way for ansible to wait for certain prompts and allow the process to complete without ansible failing the job. Again, any suggestions would be appreciated…
Here is the manual command ran:
9200L-24T-4G-E_2#$install add file flash:cat9k_lite_iosxe.16.12.04.SPA.bin activate commit
install_add_activate_commit: START Thu Mar 11 08:43:55 EST 2021
System configuration has been modified.
Press Yes(y) to save the configuration and proceed.
Press No(n) for proceeding without saving the configuration.
Press Quit(q) to exit, you may save configuration and re-enter the command. [y/n/q]y
Modified configuration has been saved
Mar 11 08:44:10.982 %INSTALL-5-INSTALL_START_INFO: R0/0: install_engine: Started install one-shot flash:cat9k_lite_iosxe.16.12.04.SPA.bin
install_add_activate_commit: Adding PACKAGE
install_add_activate_commit: Checking whether new add is allowed …
— Starting initial file syncing —
[1]: Copying flash:cat9k_lite_iosxe.16.12.04.SPA.bin from switch 1 to switch 2
[2]: Finished copying to switch 2
Info: Finished copying flash:cat9k_lite_iosxe.16.12.04.SPA.bin to the selected switch(es)
Finished initial file syncing
— Starting Add —
Performing Add on all members
[1] Add package(s) on switch 1
[1] Finished Add on switch 1
[2] Add package(s) on switch 2
[2] Finished Add on switch 2
Checking status of Add on [1 2]
Add: Passed on [1 2]
Finished Add
gzip: initramfs.cpio.gz: decompression OK, trailing garbage ignored
Following packages shall be activated:
/flash/cat9k_lite-webui.16.12.04.SPA.pkg
/flash/cat9k_lite-srdriver.16.12.04.SPA.pkg
/flash/cat9k_lite-rpboot.16.12.04.SPA.pkg
/flash/cat9k_lite-rpbase.16.12.04.SPA.pkg
This operation may require a reload of the system. Do you want to proceed? [y/n]y
— Starting Activate —
Performing Activate on all members
Mar 11 08:53:53.512: %INSTALL-5-INSTALL_AUTO_ABORT_TIMER_PROGRESS: R0/0: rollback_timer: Install auto abort timer will expire in 7200 seconds
[1] Activate package(s) on switch 1
— Starting list of software package changes —
Old files list:
Removed cat9k_lite-rpbase.16.12.03a.SPA.pkg
Removed cat9k_lite-rpboot.16.12.03a.SPA.pkg
Removed cat9k_lite-srdriver.16.12.03a.SPA.pkg
Removed cat9k_lite-webui.16.12.03a.SPA.pkg
New files list:
Added cat9k_lite-rpbase.16.12.04.SPA.pkg
Added cat9k_lite-rpboot.16.12.04.SPA.pkg
Added cat9k_lite-srdriver.16.12.04.SPA.pkg
Added cat9k_lite-webui.16.12.04.SPA.pkg
Finished list of software package changes
[1] Finished Activate on switch 1
[2] Activate package(s) on switch 2
— Starting list of software package changes —
Old files list:
Removed cat9k_lite-rpbase.16.12.03a.SPA.pkg
Removed cat9k_lite-rpboot.16.12.03a.SPA.pkg
Removed cat9k_lite-srdriver.16.12.03a.SPA.pkg
Removed cat9k_lite-webui.16.12.03a.SPA.pkg
New files list:
Added cat9k_lite-rpbase.16.12.04.SPA.pkg
Added cat9k_lite-rpboot.16.12.04.SPA.pkg
Added cat9k_lite-srdriver.16.12.04.SPA.pkg
Added cat9k_lite-webui.16.12.04.SPA.pkg
Finished list of software package changes
[2] Finished Activate on switch 2
Checking status of Activate on [1 2]
Activate: Passed on [1 2]
Finished Activate
— Starting Commit —
Performing Commit on all members
[1] Commit package(s) on switch 1
[1] Finished Commit on switch 1
[2] Commit package(s) on switch 2
[2] Finished Commit on switch 2
Checking status of Commit on [1 2]
Commit: Passed on [1 2]
Finished Commit
Install will reload the system now!
SUCCESS: install_add_activate_commit Thu Mar 11 08:55:16 EST 2021
Mar 11 08:55:17.946 %INSTALL-5-INSTALL_COMPLETED_INFO: R0/0: install_engine: Completed install one-shot PACKAGE flash:cat9k_lite_iosxe.16.12.04.SPA.bin
9200L-24T-4G-E_2#
name: Copy IOS to all stack members and update
ansible.netcommon.cli_command:
command: install add file flash:cat9k_lite_iosxe.16.12.04.SPA.bin activate commit
check_all: true
prompt:
“This operation may require a reload of the system. Do you want to proceed”
“Install will reload the system now”
answer:
y
y
Since I tested initially I had some timeout issues, so prior to running, I ran:
export ANSIBLE_PERSISTENT_TIMEOUT=2700
I still receive timeout failures:
The full traceback is:
WARNING: The below traceback may not be related to the actual failure.
File “/tmp/ansible_ansible.netcommon.cli_command_payload_ApkceD/ansible_ansible.netcommon.cli_command_payload.zip/ansible_collections/ansible/netcommon/plugins/modules/cli_command.py”, line 170,
File “/tmp/ansible_ansible.netcommon.cli_command_payload_ApkceD/ansible_ansible.netcommon.cli_command_payload.zip/ansible/module_utils/connection.py”, line 185, in rpc
raise ConnectionError(to_text(msg, errors=‘surrogate_then_replace’), code=code)
fatal: [10.82.2.125]: FAILED! => {
“changed”: false,
“invocation”: {
“module_args”: {
“answer”: [
“y”,
“y”
],
“check_all”: true,
“command”: “install add file flash:cat9k_lite_iosxe.16.12.04.SPA.bin activate commit”,
“newline”: true,
“prompt”: [
“This operation may require a reload of the system. Do you want to proceed”,
“Install will reload the system now”
],
“sendonly”: false
}
},
“msg”: “timeout value 30 seconds reached while trying to send command: install add file flash:cat9k_lite_iosxe.16.12.04.SPA.bin activate commit”
}
I resolved this by editing the ansible.cfg variable command_timeout = 30 to command_timeout = 2700 (accounting for the long operation of copying files across stack members and updating.
I’d rather not keep this variable at 2700. Is there a way I can temporarily set this variable in group_var or elsewhere?