Skip to content

test #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

test #55

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
host_key_checking = False
retry_files_enabled = False
no_target_syslog = False
[libssh_connection]
publickey_algorithms = ssh-rsa
29 changes: 22 additions & 7 deletions roles/restore/tasks/ios/overwrite.yml
Original file line number Diff line number Diff line change
@@ -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'