Skip to content

Commit a70b56d

Browse files
authored
Merge pull request #55 from IPvSean/master
test
2 parents 62c8e38 + b1c3459 commit a70b56d

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

ansible.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
host_key_checking = False
33
retry_files_enabled = False
44
no_target_syslog = False
5+
[libssh_connection]
6+
publickey_algorithms = ssh-rsa

roles/restore/tasks/ios.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
ansible.builtin.debug:
33
msg: "restoring from /backup/{{ rollback_date }}/{{ inventory_hostname }}.txt"
44

5+
## overwrite doesn't work as of June 2025
56
- name: Include task list in play
6-
ansible.builtin.include_tasks: "ios/{{ restore_mode | default('overwrite') }}.yml"
7+
ansible.builtin.include_tasks: "ios/{{ restore_mode | default('merge') }}.yml"
78

89
- name: Print to terminal window
910
ansible.builtin.debug:
10-
msg: "Restore is complete for device {{ inventory_hostname }} is set to {{ rollback_date }} timestamp, restored with restore_mode {{ restore_mode | default('overwrite') }} "
11+
msg: "Restore is complete for device {{ inventory_hostname }} is set to {{ rollback_date }} timestamp, restored with restore_mode {{ restore_mode | default('merge') }} "

roles/restore/tasks/ios/overwrite.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
11
---
2-
- name: Copy file over to flash on network device
3-
ansible.builtin.command: "scp -o StrictHostKeyChecking=no /tmp/{{ rollback_date }}/{{ inventory_hostname }}.txt {{ ansible_user }}@{{ inventory_hostname }}:flash:{{ rollback_date }}-{{ inventory_hostname }}.txt"
4-
delegate_to: localhost
2+
### -O forces scp versus sftp which Cisco IOS does support
3+
- name: Copy file over to flash on network device using SCP
4+
ansible.builtin.shell: >
5+
scp -O -o StrictHostKeyChecking=no
6+
/backup/{{ rollback_date }}/{{ inventory_hostname }}.txt
7+
{{ inventory_hostname }}:'flash:{{ rollback_date }}-{{ inventory_hostname }}.txt'
8+
run_once: true
9+
delegate_to: backup-server
510

6-
- name: Overwrite startup config - archive
7-
cisco.ios.ios_config:
8-
lines:
9-
- 'archive'
11+
# - name: Copy file over to flash on network device
12+
# ansible.builtin.shell: >
13+
# scp -O -o StrictHostKeyChecking=no
14+
# /tmp/{{ rollback_date }}/{{ inventory_hostname }}.txt
15+
# {{ ansible_user }}@{{ inventory_hostname }}:'flash:{{ rollback_date }}-{{ inventory_hostname }}.txt'
16+
# delegate_to: localhost
17+
# run_once: true
18+
19+
# - name: Copy file over to flash on network device
20+
# ansible.netcommon.net_put:
21+
# src: "/tmp/{{ rollback_date }}/{{ inventory_hostname }}.txt"
22+
# dest: "flash:{{ rollback_date }}-{{ inventory_hostname }}.txt"
1023

1124
- name: Overwrite startup config - overwrite
25+
environment:
26+
ANSIBLE_LIBSSH_PUBLICKEY_ALGORITHMS: ssh-rsa
1227
cisco.ios.ios_command:
1328
commands:
1429
- command: 'configure replace flash://{{ rollback_date }}-{{ inventory_hostname }}.txt force'

0 commit comments

Comments
 (0)