restic: exclude als Variable (#7)

restic: exclude als Variable
---------
Template Datei gelöscht
Variablen angelegt
Aufgabe mit blockinfile statt template

Co-authored-by: Michael Grote <38253905+quotengrote@users.noreply.github.com>
Reviewed-on: mg/ansible#7
This commit is contained in:
Michael Grote 2020-12-22 12:23:10 +01:00
parent b96545ba03
commit 786506d902
4 changed files with 25 additions and 14 deletions

View file

@ -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"

View file

@ -1,2 +1,9 @@
---
restic_folders_to_backup: "/usr/local /etc /root /var/www /home"
restic_exclude: |
._*
desktop.ini
.Trash-*
**/**cache***/**
**/**Cache***/**
**/**AppData***/**

View file

@ -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

View file

@ -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