Hi all, I am struggling to find documentation or a module that will help me resolve this issue that I am experiencing.
The requirement - I am SSHing into a Cisco IOS device and need to run one command that is interactive.
Example of how to do it manually (I removed the values for variables for clarity):
TEST-ROUTER# copy tftp://{{ tftp_server }}/{{ filename }} bootflash://{{ filename }} vrf {{number}}
Destination filename [XXXXXXXXXXXXXX.crt]? XXXXXXXXXXXXXX.crt
Accessing tftp://XX.XX.XX.XX/XXXXXXXXXXXXXX.crtâŚ
Loading XXXXXXXXXXXXXX.crt from XX.XX.XX.XX (via Sdwan-system-intf): !
[OK - 5280 bytes]
5280 bytes copied in 2.639 secs (1989 bytes/sec)
So as you can see, after providing the command âcopy tftp://{{ tftp_server }}/{{ filename }} bootflash://{{ filename }} vrf {{number}}â, the system prompts for the destination filename which is simply the filename passed.
I have attempted using the ansible .builtin.expect and .ios.ios_command, however, the ansible playbook continues to timeout on the first command âcopy tftp://{{ tftp_server }}/{{ filename }} bootflash://{{ filename }} vrf {{number}}â.
Here is the task that is failing:
- name: Push certificate via TFTP if certificate is not present when: dir_check.stdout is not defined or filename not in (dir_check.stdout[0] | default('')) cisco.ios.ios_command: commands: - "copy tftp://{{ tftp_server }}/{{ filename }} bootflash://{{ filename }} vrf 1" - "{{ filename }}" register: copy_output