Working on a new backup protocol
This commit is contained in:
1 parent
57778dc4e2
commit
f68cfbf42b
3 files changed
+40
No files matched your search
@@ -1,6 +1,8 @@
|
|||||||
---
|
---
|
||||||
all:
|
all:
|
||||||
hosts:
|
hosts:
|
||||||
|
openwrt:
|
||||||
|
ansible_host: "10.77.7.254"
|
||||||
blacktide:
|
blacktide:
|
||||||
ansible_host: "192.168.3.2"
|
ansible_host: "192.168.3.2"
|
||||||
connection: "local"
|
connection: "local"
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
---
|
---
|
||||||
|
- name: Backup OpenWRT
|
||||||
|
hosts: openwrt
|
||||||
|
remote_user: root
|
||||||
|
gather_facts: false
|
||||||
|
vars:
|
||||||
|
local_backup_dir:
|
||||||
- name: Docker Infrastructure Compose Backups
|
- name: Docker Infrastructure Compose Backups
|
||||||
hosts: docker_nodes
|
hosts: docker_nodes
|
||||||
become: true
|
become: true
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
- name: Backup OpenWrt Configuration
|
||||||
|
hosts: openwrt
|
||||||
|
remote_user: root
|
||||||
|
gather_facts: false
|
||||||
|
roles:
|
||||||
|
- community.openwrt.init
|
||||||
|
vars:
|
||||||
|
backup_dir: "./backups/{{ inventory_hostname }}"
|
||||||
|
remote_tmp_file: "/tmp/backup-{{ inventory_hostname }}-{{ lookup('pipe', 'date +%Y-%m-%d') }}.tar.gz"
|
||||||
|
tasks:
|
||||||
|
- name: Ensure local backup directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ backup_dir }}"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
delegate_to: localhost
|
||||||
|
|
||||||
|
- name: Generate sysupgrade backup archive on OpenWrt
|
||||||
|
community.openwrt.command:
|
||||||
|
cmd: "umask go=; sysupgrade -b {{ remote_tmp_file }}"
|
||||||
|
|
||||||
|
- name: Fetch backup archive to Ansible controller
|
||||||
|
ansible.builtin.fetch:
|
||||||
|
src: "{{ remote_tmp_file }}"
|
||||||
|
dest: "{{ backup_dir }}/"
|
||||||
|
flat: true
|
||||||
|
|
||||||
|
- name: Remove temporary backup file from OpenWrt
|
||||||
|
community.openwrt.file:
|
||||||
|
path: "{{ remote_tmp_file }}"
|
||||||
|
state: absent
|
||||||
Reference in new issue
Block a user