Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- backup.yaml
- ---
- - name: Backup Mikrotik Devices
- hosts: routers
- connection: paramiko
- gather_facts: no
- tasks:
- - name: Set current time
- set_fact:
- time: "{{ lookup('pipe','date \"+%Y-%m-%d-%H-%M\"') }}"
- - name: Starting ROS System Backup filename .backup
- community.routeros.command:
- commands: "/system backup save name {{ inventory_hostname }}"
- - name: Starting ROS Configuration Backup filename .rsc
- community.routeros.command:
- commands: "/export file={{ inventory_hostname }}"
- - name: Download backup files from the network device using SFTP
- ansible.netcommon.net_get:
- src: "{{ item }}"
- dest: "/etc/ansible/backup/{{ item }}"
- protocol: sftp
- loop:
- - "{{ inventory_hostname }}.backup"
- - "{{ inventory_hostname }}.rsc"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement