Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions host_vars/druif/backups.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---

backup_sources:
- "{{ ansible_user_dir }}/projects"
- "{{ ansible_user_dir }}/projects/"
- "{{ ansible_user_dir }}/.bash_history"
- "{{ ansible_user_dir }}/.python_history"
- "{{ ansible_user_dir }}/.zsh_history"
- "/mnt/share/archive"
- "/boot/loader"
- "/mnt/share/archive/"
- "/mnt/share/media/podcasts/"
- "/mnt/share/media/audiobooks/"

backup_repos:
- "{{ ansible_user_dir }}/backup"
Expand Down
13 changes: 11 additions & 2 deletions roles/backups/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@
community.general.pacman:
name: "restic"

- name: "Create .local/bin/"
- name: "Create directories"
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.local/bin/"
path: "{{ ansible_user_dir }}/{{ item }}"
state: "directory"
mode: "0755"
loop:
- ".local/bin/"
- ".config/restic/"

- name: "Copy exclude.txt"
ansible.builtin.copy:
src: "exclude.txt"
dest: "{{ backups_restic_path_exclude_file }}"
mode: "0644"

- name: "Copy backup script"
when: "backup_sources is defined and backup_repos is defined"
Expand Down
2 changes: 1 addition & 1 deletion roles/backups/templates/backup.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [ $# -eq 0 ]
then
{% for repo in backup_repos %}
echo "[*] Running Restic backup to {{ repo }}."
${RESTIC} --repo "{{ repo }}" backup --exclude-larger-than="105M" "{{ backup_sources|map('quote')|join('\" \"') }}"
${RESTIC} --repo "{{ repo }}" backup --exclude-file "{{ backups_restic_path_exclude_file }}" {{ backup_sources | map("quote") | join(" ") }}
{% endfor %}
else
echo "[*] Running ${RESTIC} $*"
Expand Down
Loading