From 81f7bc24c5bcc1cf059eb25f876469c867fd2f3e Mon Sep 17 00:00:00 2001 From: Reisber Date: Tue, 15 Sep 2026 14:50:42 +0000 Subject: [PATCH] Backup_mikrot Signed-off-by: Reisber --- Ansible/backup_daily.yaml | 21 +++++++++++++++++++++ Ansible/hosts.ini | 12 ++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Ansible/backup_daily.yaml create mode 100644 Ansible/hosts.ini diff --git a/Ansible/backup_daily.yaml b/Ansible/backup_daily.yaml new file mode 100644 index 0000000..9fa04b1 --- /dev/null +++ b/Ansible/backup_daily.yaml @@ -0,0 +1,21 @@ +--- +- name: Backup router + hosts: mikrotik_routers + gather_facts: false + connection: ansible.netcommon.network_cli + + tasks: + - name: backup-file create + community.routeros.command: + commands: /system/backup/save dont-encrypt=yes name=backup_mikrotik + + - name: backup-file download + net_get: + src: "/backup_mikrotik.backup" + dest: "/ansible-for-games/backups/{{inventory_hostname}}" + protocol: scp + +# - name: Save backup with correct hostname +# ansible.builtin.copy: +# src: /ansible-for-games/ +# dest: "/ansible-for-games/backups/{{inventory_hostname}}" diff --git a/Ansible/hosts.ini b/Ansible/hosts.ini new file mode 100644 index 0000000..235a0d5 --- /dev/null +++ b/Ansible/hosts.ini @@ -0,0 +1,12 @@ +# Group For routers +[mikrotik_routers] +Mikrotik1 ansible_host=192.168.100.30 # mikrotik in nebula + + +[mikrotik_routers:vars] +ansible_user=admin +ansible_password=root +ansible_network_os=routeros +ansible_connection=ansible.netcommon.network_cli + +#better use ansible vault, but for test that will do