Solution: Do not forget the ticks around the 'y'.

- name: remove old OS files
        ios_command:
          commands:
            - command: install remove inactive
              prompt: Do you want to remove the above files
              answer: 'y'
        vars:
          ansible_command_timeout: 180


Am Di., 4. Feb. 2020 um 16:27 Uhr schrieb Heinz Meier <
[email protected]>:

> Still the same problem (timeout). I copied the string direct from the
> switch. Any idea how to debug this in deep?
>
>
> The full traceback is:
>   File
> "/tmp/ansible_ios_command_payload_dz14oih4/ansible_ios_command_payload.zip/ansible/module_utils/network/ios/ios.py",
> line 135, in run_commands
>     return connection.run_commands(commands=commands, check_rc=check_rc)
>   File
> "/tmp/ansible_ios_command_payload_dz14oih4/ansible_ios_command_payload.zip/ansible/module_utils/connection.py",
> line 185, in __rpc__
>     raise ConnectionError(to_text(msg, errors='surrogate_then_replace'),
> code=code)
>
> fatal: [switch]: FAILED! => {
>     "changed": false,
>     "invocation": {
>         "module_args": {
>             "auth_pass": null,
>             "authorize": null,
>             "commands": [
>                 {
>                     "answer": "y",
>                     "check_all": false,
>                     "command": "install remove inactive",
>                     "newline": true,
>                     "output": null,
>                     "prompt": "Do you want to remove the above files",
>                     "sendonly": false
>                 }
>             ],
>             "host": null,
>             "interval": 1,
>             "match": "all",
>             "password": null,
>             "port": null,
>             "provider": null,
>             "retries": 10,
>             "ssh_keyfile": null,
>             "timeout": null,
>             "username": null,
>             "wait_for": null
>         }
>     },
>     "msg": "command timeout triggered, timeout value is 300 secs.\nSee the
> timeout setting options in the Network Debug and Troubleshooting Guide."
>
> Am Di., 4. Feb. 2020 um 16:01 Uhr schrieb Ganesh Nalawade <
> [email protected]>:
>
>> The value of prompt option is a python regex hence either handle special
>> character in prompt correctly by using escape character or remove those
>> characters from prompt completely.
>> For example:
>>
>> - name: remove old OS files
>>         ios_command:
>>           commands:
>>             - command: install remove inactive
>>                prompt: Do you want to remove above files
>>                answer: y
>>
>>
>>  On Tue, 4 Feb 2020 at 3:33 PM, Heinz Meier <[email protected]>
>> wrote:
>>
>>> Error output is:
>>>
>>> The full traceback is:
>>>   File
>>> "/tmp/ansible_ios_command_payload_hxb3x8bq/ansible_ios_command_payload.zip/ansible/module_utils/network/ios/ios.py",
>>> line 135, in run_commands
>>>     return connection.run_commands(commands=commands, check_rc=check_rc)
>>>   File
>>> "/tmp/ansible_ios_command_payload_hxb3x8bq/ansible_ios_command_payload.zip/ansible/module_utils/connection.py",
>>> line 185, in __rpc__
>>>     raise ConnectionError(to_text(msg, errors='surrogate_then_replace'),
>>> code=code)
>>>
>>> fatal: [switch]: FAILED! => {
>>>     "changed": false,
>>>     "invocation": {
>>>         "module_args": {
>>>             "auth_pass": null,
>>>             "authorize": null,
>>>             "commands": [
>>>                 {
>>>                     "answer": "y",
>>>                     "check_all": false,
>>>                     "command": "install remove inactive",
>>>                     "newline": true,
>>>                     "output": null,
>>>                     "prompt": "\\[y\\/n\\]",
>>>                     "sendonly": false
>>>                 }
>>>             ],
>>>             "host": null,
>>>             "interval": 1,
>>>             "match": "all",
>>>             "password": null,
>>>             "port": null,
>>>             "provider": null,
>>>             "retries": 10,
>>>             "ssh_keyfile": null,
>>>             "timeout": null,
>>>             "username": null,
>>>             "wait_for": null
>>>         }
>>>     },
>>>     "msg": "command timeout triggered, timeout value is 180 secs.\nSee
>>> the timeout setting options in the Network Debug and Troubleshooting Guide."
>>> }
>>>
>>> Am Di., 4. Feb. 2020 um 15:28 Uhr schrieb Heinz Meier <
>>> [email protected]>:
>>>
>>>> Hi,
>>>>
>>>> I have a problem with the ios_command and the C9200L switch when
>>>> updating the IOS-XE. One step of the upgrade is
>>>>
>>>> On step is to remove inactive IOS versions:
>>>>
>>>> #install remove inactive
>>>> (...)
>>>> Do you want to remove the above files? [y/n]
>>>>
>>>>
>>>> the part of the playbook looks like:
>>>>
>>>> ---
>>>> - hosts: cisco
>>>>   tasks:
>>>>
>>>>     - name: Upgrade IOS-XE
>>>>       block:
>>>>
>>>>       - name: remove old OS files
>>>>         ios_command:
>>>>           commands:
>>>>             - command: install remove inactive
>>>>               prompt: '[y/n]'
>>>>               answer: 'y'
>>>>         vars:
>>>>           ansible_command_timeout: 180
>>>>
>>>>       when: (ansible_net_version != compliant_ios_version) and
>>>>             (ansible_net_model is regex("9200"))
>>>>
>>>>
>>>>
>>>> Anytime I run this playbook this tasks fails with the timeout. 180 sec
>>>> should be enough time to delete the files.
>>>>
>>>> I tried to prolong the timeout value, and all combinations of the full
>>>> text of the question and backslashes in front of the brackets and the
>>>> forward slash.
>>>>
>>>> Always timeout.
>>>>
>>>> Any ideas?
>>>>
>>>> Michael Schwartzkopff
>>>>
>>>> --
>>>> 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/0aae16a2-4463-4828-a3e5-bdf9190ce35e%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/ansible-project/0aae16a2-4463-4828-a3e5-bdf9190ce35e%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CAFFTi_JWXSKFuvtB_tHnAz3CG8Hr1a%3DNSMbPX446frsyueWiwQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CAFFTi_JWXSKFuvtB_tHnAz3CG8Hr1a%3DNSMbPX446frsyueWiwQ%40mail.gmail.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/CA%2B6y2sGsK9621POh_NjYu6ioHokwcdAOuuikKyO4ahGnnVbtag%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CA%2B6y2sGsK9621POh_NjYu6ioHokwcdAOuuikKyO4ahGnnVbtag%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/CAFFTi_%2Bt5101%2ByyWf%3DH%3DnFDQToHzosBFfmLOURHVbsKdciL4Kw%40mail.gmail.com.

Reply via email to