I answered my own question ;)

I added command_timeout = 2700 to group_vars

Have a good weekend 

On Friday, March 12, 2021 at 1:32:37 PM UTC-5 [email protected] wrote:

> 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?
> On Friday, March 12, 2021 at 8:57:43 AM UTC-5 [email protected] wrote:
>
>> I have tried using: ansible.netcommon.cli_command
>>
>> Here is the snippet of playbook that is failing:
>>       - 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"
>> }
>>
>>
>> Any help is appreciated!
>>
>> On Thursday, March 11, 2021 at 11:25:50 AM UTC-5 [email protected] wrote:
>>
>>> Thanks Ganesh,
>>>
>>> I'll give that a try and let you know.
>>>
>>> On Thursday, March 11, 2021 at 10:32:15 AM UTC-5 [email protected] 
>>> wrote:
>>>
>>>> You can use cli_command module to handle multiple prompts on network 
>>>> device.
>>>> Refer: 
>>>>
>>>> https://docs.ansible.com/ansible/latest/collections/ansible/netcommon/cli_command_module.html
>>>>
>>>> On Thu, 11 Mar 2021 at 8:37 PM, [email protected] <[email protected]> 
>>>> wrote:
>>>>
>>>>> 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
>>>>>
>>>>> Image added. Version: 16.12.4.0.4480
>>>>> install_add_activate_commit: Activating PACKAGE
>>>>>
>>>>> 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#
>>>>>
>>>>> On Thursday, March 11, 2021 at 12:17:13 AM UTC-5 [email protected] 
>>>>> wrote:
>>>>>
>>>>>> I'm trying to update a cisco switch stack with ansible and I would 
>>>>>> like to use the archive command, but that doesn't work with .bin files.
>>>>>>
>>>>>> For the 9200 series switches, I can only download .bin files.  
>>>>>>
>>>>>> I have tried:
>>>>>> ios_command:
>>>>>>           commands:
>>>>>>             - command: install add file 
>>>>>> flash:cat9k_lite_iosxe.16.12.04.SPA.bin
>>>>>>               wait_for: result[0] contains SUCCESS
>>>>>>
>>>>>> That isn't working for me either. I may need to enter a timeout as 
>>>>>> well. 
>>>>>>
>>>>>> Please let me know if you have any suggestions. Thanks in advance.
>>>>>>
>>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Ansible Project" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected].
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/ansible-project/f5aa4119-9617-4077-b11b-8b9adb848ce1n%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/ansible-project/f5aa4119-9617-4077-b11b-8b9adb848ce1n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> -- 
>>>> Regards,
>>>> Ganesh B. Nalawade
>>>> Principal Engineer
>>>> Ansible by Red Hat
>>>> irc: ganeshrn
>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bac38eed-29e0-41e9-a23c-e551008cd63an%40googlegroups.com.

Reply via email to