diff --git a/group_vars/all.yml b/group_vars/all.yml index 752a9919..bec80160 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -18,6 +18,18 @@ restic_mount: "/mnt/restic" restic_mount_user: restic restic_mount_password: "{{ lookup('keepass', 'fileserver_smb_user_restic', 'password') }}" + restic_exclude: | + ._* + desktop.ini + .Trash-* + **/**cache***/** + **/**Cache***/** + **/**AppData***/** + /var/lib/docker/volumes/***Musik*** + /var/lib/docker/volumes/***musik*** + # https://github.com/restic/restic/issues/1005 + # https://forum.restic.net/t/exclude-syntax-confusion/1531/12 + ### mgrote.tmux tmux_conf_destination: "/home/mg/.tmux.conf" tmux_bashrc_destination: "/home/mg/.bashrc" diff --git a/roles/mgrote.restic/defaults/main.yml b/roles/mgrote.restic/defaults/main.yml index dfecf964..e6830f8c 100644 --- a/roles/mgrote.restic/defaults/main.yml +++ b/roles/mgrote.restic/defaults/main.yml @@ -1,2 +1,9 @@ --- restic_folders_to_backup: "/usr/local /etc /root /var/www /home" + restic_exclude: | + ._* + desktop.ini + .Trash-* + **/**cache***/** + **/**Cache***/** + **/**AppData***/** diff --git a/roles/mgrote.restic/tasks/main.yml b/roles/mgrote.restic/tasks/main.yml index 543624ea..6dbf54cc 100644 --- a/roles/mgrote.restic/tasks/main.yml +++ b/roles/mgrote.restic/tasks/main.yml @@ -37,11 +37,13 @@ dest: "/usr/local/bin/restic_backup.sh" mode: a+x - - name: copy exclude.txt + - name: create exclude.txt become: yes - ansible.builtin.template: - src: "exclude.txt" - dest: "/etc/restic/exclude.txt" + ansible.builtin.blockinfile: + path: "/etc/restic/exclude.txt" + create: yes + block: "{{ restic_exclude }}" + mode: 0644 - name: copy password.txt become: yes diff --git a/roles/mgrote.restic/templates/exclude.txt b/roles/mgrote.restic/templates/exclude.txt deleted file mode 100644 index b4298a60..00000000 --- a/roles/mgrote.restic/templates/exclude.txt +++ /dev/null @@ -1,10 +0,0 @@ -._* -desktop.ini -.Trash-* -**/**cache***/** -**/**Cache***/** -**/**AppData***/** -/var/lib/docker/volumes/***Musik*** -/var/lib/docker/volumes/***musik*** -# https://github.com/restic/restic/issues/1005 -# https://forum.restic.net/t/exclude-syntax-confusion/1531/12