Skip to content

Commit dd5672f

Browse files
authored
Merge pull request #52 from roles-ansible/cache
optional cache directory
2 parents 3e39c92 + d30e30f commit dd5672f

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ansible-galaxy install arillso.restic
6969
| `restic_version` | `'0.12.1'` | The version of Restic to install |
7070
| `restic_download_path` | `'/opt/restic'` | Download location for the restic binary |
7171
| `restic_install_path` | `'/usr/local/bin'` | Install location for the restic binary |
72-
| `restic_script_dir` | `'/opt/restic'` | Location of the generated backup scripts |
72+
| `restic_script_dir` | `'/opt/restic'` | Location of the generated backup scripts |
7373
| `restic_log_dir` | `'{{ restic_script_dir }}/log'` | Location of the logs of the backup scripts |
7474
| `restic_repos` | `{}` | A dictionary of repositories where snapshots are stored. *(More Info: [Repos](#Repos))* |
7575
| `restic_backups` | `{}` (or `[]`) | A list of dictionaries specifying the files and directories to be backed up *(More Infos: [Backups](#Backups))* |
@@ -79,6 +79,8 @@ ansible-galaxy install arillso.restic
7979
| `restic_dir_group` | `'{{ansible_user}}'` | The group of all created dirs |
8080
| `restic_no_log` | `true` | set to false to see hidden ansible logs |
8181
| `restic_do_not_cleanup_cron ` | `false` | we changed the cron location and clean up the old one. You can skip the cleanup here |
82+
| `restic__cache_config` | `false` | configure custom cache directory |
83+
| `restic__cache_dir` | `'~/.cache/restic'` | define custom cache directory |
8284

8385
### Repos
8486
Restic stores data in repositories. You have to specify at least one repository

defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@ restic_systemd_timer_default_OnCalendar: '*-*-* 02:00:00'
2424
submodules_versioncheck: false
2525
restic_do_not_cleanup_cron: false
2626

27+
# cache
28+
restic__cache_config: false
29+
restic__cache_dir: '~/.cache/restic'
30+
2731
# outdated variables because of irritating names, but kept for compatibility
2832
restic_create_cron: false

templates/restic_script_Linux.j2

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ fi
2323
# your normal workflow here...
2424

2525

26-
27-
2826
{% if item.disable_logging is defined and item.disable_logging %}
2927
{% set backup_result_log, backup_output_log = "/dev/null", "/dev/null" %}
3028
{% set forget_result_log, forget_output_log = "/dev/null", "/dev/null" %}
@@ -38,6 +36,10 @@ fi
3836
{% endif %}
3937
{% endif %}
4038

39+
{% if restic__cache_config | bool -%}
40+
export XDG_CACHE_HOME={{ restic__cache_dir }}
41+
{% endif %}
42+
4143
export RESTIC_REPOSITORY={{ restic_repos[item.repo].location }}
4244
export RESTIC_PASSWORD='{{ restic_repos[item.repo].password | regex_replace('\'', '\'\\\'\'') }}'
4345
BACKUP_NAME={{ item.name }}

vars/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ restic_os_variables:
1010
paths:
1111
- 'vars'
1212

13-
playbook_version_number: 22 # should be int
13+
playbook_version_number: 23 # should be int
1414
playbook_version_path: 'do1jlr.restic.version'

0 commit comments

Comments
 (0)