How to work around PERSISTENT_COMMAND_TIMEOUT

Hi there,

Every ansible network command has a PERSISTENT_COMMAND_TIMEOUT which “controls the amount of time to wait for response from remote device before timing out persistent connection”.

Actually, when using the net_get module with a very large file, the command times out during the transfer, even though both sides are still exchanging SCP messages, meaning the transfer is still underway & active.

Shouldn’t it time out only when there is no more communication between both nodes for the PERSISTENT_COMMAND_TIMEOUT period of time?

  • Either we are supposed to guess how long each transfer is going to last, depending on the size of the file, the network load, the CPU load on both sides & in between and so on and adjust PERSISTENT_COMMAND_TIMEOUT accordingly

  • or there is way to avoid the command to timeout during the transfer, while still timing out when the target does not answer anymore after some time

Any suggestion?

I have just found a mini workaround with ansible_command_timeout which can be used per command (instead of modifying the global PERSISTENT_COMMAND_TIMEOUT for all commands):
`
vars:
ansible_connection: network_cli
ansible_network_os: nxos
ansible_password: “{{ connections.ssh.password }}”
ansible_user: “{{ connections.ssh.username }}”
ansible_command_timeout: “{{ firmware.transfer_timeout }}”
net_get:

`

However, if there is a real issue during the transfer so that the target does not answer any more, we have to wait until ansible_command_timeout times out before moving on, although the transfer issue may have happened at the beginning of the transfer.