-1

Running ansible 2.6

This error happens when I try to run the command:

verify /md5 flash:/{ios_file}

This is the output of the command:

TASK [IOS - MD5 CHECK - PASS1] **************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: timeout trying to send command: verify /md5 c2960x-universalk9-mz.152-2.E8.bin
fatal: [pdctestisesw7]: FAILED! => changed=false 
  module_stderr: |-
    Traceback (most recent call last):
      File "/tmp/ansible_cr7Tgd/ansible_module_ios_command.py", line 247, in <module>
        main()
      File "/tmp/ansible_cr7Tgd/ansible_module_ios_command.py", line 217, in main
        responses = run_commands(module, commands)
      File "/tmp/ansible_cr7Tgd/ansible_modlib.zip/ansible/module_utils/network/ios/ios.py", line 148, in run_commands
      File "/tmp/ansible_cr7Tgd/ansible_modlib.zip/ansible/module_utils/connection.py", line 174, in __rpc__
    ansible.module_utils.connection.ConnectionError: timeout trying to send command: verify /md5 c2960x-universalk9-mz.152-2.E8.bin
  module_stdout: ''
  msg: MODULE FAILURE
  rc: 1
        to retry, use: --limit @/export/home/e130885/playbooks/ios-switch-upgrade/upgrade_ios_switch_v1.retry

Here is the task being executed:

  - name: IOS - MD5 CHECK - PASS1
    ios_command:
      commands:
        - command: "verify /md5 {{ compliant_ios_file }}"
    register: md5_response
    vars:
      ansible_command_timeout: 3000
    when: 'compliant_ios_file in dir_response.stdout[0]'

This only seems to happen on commands that take more than a second to execute.

Paulw11
  • 108,386
  • 14
  • 159
  • 186
Brian Koch
  • 11
  • 1
  • 5

1 Answers1

0

There are different ways to achieve it, the following works fine for me. The timeout values varies depending on router type.

>   - name: VERIFY_IMAGE
>     ios_command:
>         commands:
>         - "verify /md5 flash:c800-universalk9-mz.SPA.154-3.M10.bin"
>         wait_for:
>         - result[0] contains "a8216179d49e598579e21b7e5abc9046"
>         retries: 1
>     vars:
>         ansible_command_timeout: 120