diff --git a/ansible.cfg b/ansible.cfg index 0a39d93e..2aa551ff 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -2,3 +2,5 @@ host_key_checking = False retry_files_enabled = False no_target_syslog = False +[libssh_connection] +publickey_algorithms = ssh-rsa diff --git a/roles/restore/tasks/ios/overwrite.yml b/roles/restore/tasks/ios/overwrite.yml index 262d6746..a1f580aa 100644 --- a/roles/restore/tasks/ios/overwrite.yml +++ b/roles/restore/tasks/ios/overwrite.yml @@ -1,14 +1,29 @@ --- -- name: Copy file over to flash on network device - ansible.builtin.command: "scp -o StrictHostKeyChecking=no /tmp/{{ rollback_date }}/{{ inventory_hostname }}.txt {{ ansible_user }}@{{ inventory_hostname }}:flash:{{ rollback_date }}-{{ inventory_hostname }}.txt" - delegate_to: localhost +### -O forces scp versus sftp which Cisco IOS does support +- name: Copy file over to flash on network device using SCP + ansible.builtin.shell: > + scp -O -o StrictHostKeyChecking=no + /backup/{{ rollback_date }}/{{ inventory_hostname }}.txt + {{ inventory_hostname }}:'flash:{{ rollback_date }}-{{ inventory_hostname }}.txt' + run_once: true + delegate_to: backup-server -- name: Overwrite startup config - archive - cisco.ios.ios_config: - lines: - - 'archive' +# - name: Copy file over to flash on network device +# ansible.builtin.shell: > +# scp -O -o StrictHostKeyChecking=no +# /tmp/{{ rollback_date }}/{{ inventory_hostname }}.txt +# {{ ansible_user }}@{{ inventory_hostname }}:'flash:{{ rollback_date }}-{{ inventory_hostname }}.txt' +# delegate_to: localhost +# run_once: true + +# - name: Copy file over to flash on network device +# ansible.netcommon.net_put: +# src: "/tmp/{{ rollback_date }}/{{ inventory_hostname }}.txt" +# dest: "flash:{{ rollback_date }}-{{ inventory_hostname }}.txt" - name: Overwrite startup config - overwrite + environment: + ANSIBLE_LIBSSH_PUBLICKEY_ALGORITHMS: ssh-rsa cisco.ios.ios_command: commands: - command: 'configure replace flash://{{ rollback_date }}-{{ inventory_hostname }}.txt force'