From bcdc460297aaf2403b0f907e4469445fddfb8d6b Mon Sep 17 00:00:00 2001 From: Ruakij Date: Thu, 22 Oct 2026 08:25:43 +0000 Subject: [PATCH] Copy per-host files of kopia_backup from a files list, empty by default --- kopia_backup/defaults/main.yml | 2 ++ kopia_backup/tasks/main.yml | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/kopia_backup/defaults/main.yml b/kopia_backup/defaults/main.yml index e33df93..d860013 100644 --- a/kopia_backup/defaults/main.yml +++ b/kopia_backup/defaults/main.yml @@ -20,6 +20,8 @@ kopia_backup: # Database dumps written to /var/backups/dumps before the snapshot, which then includes that directory. # Each item: file, container, command (run with sh -c inside the container, output is the dump). dumps: [] + # Files copied to the host as they are, each { src: local path, dest, mode }; owned by root. + files: [] # Snapshot the newest k3s etcd snapshot, staged in /var/backups/etcd. etcd_snapshot: false # Explicit UTC: the hosts run in different timezones. diff --git a/kopia_backup/tasks/main.yml b/kopia_backup/tasks/main.yml index 121dd8a..47e3d1f 100644 --- a/kopia_backup/tasks/main.yml +++ b/kopia_backup/tasks/main.yml @@ -73,6 +73,15 @@ when: kopia_backup_status.rc != 0 no_log: true +- name: Install the files of the host + ansible.builtin.copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + mode: "{{ item.mode }}" + owner: root + group: root + loop: "{{ kopia_backup.files }}" + - name: Install the backup script ansible.builtin.template: src: kopia-backup.j2