1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_restic.git synced 2024-12-11 23:41:32 +01:00

optional cache directory

This commit is contained in:
L3D 2022-01-18 17:20:02 +01:00
parent 3e39c9200d
commit d30e30fcae
Signed by: l3d
GPG key ID: CD08445BFF4313D1
4 changed files with 12 additions and 4 deletions

View file

@ -69,7 +69,7 @@ ansible-galaxy install arillso.restic
| `restic_version` | `'0.12.1'` | The version of Restic to install |
| `restic_download_path` | `'/opt/restic'` | Download location for the restic binary |
| `restic_install_path` | `'/usr/local/bin'` | Install location for the restic binary |
| `restic_script_dir` | `'/opt/restic'` | Location of the generated backup scripts |
| `restic_script_dir` | `'/opt/restic'` | Location of the generated backup scripts |
| `restic_log_dir` | `'{{ restic_script_dir }}/log'` | Location of the logs of the backup scripts |
| `restic_repos` | `{}` | A dictionary of repositories where snapshots are stored. *(More Info: [Repos](#Repos))* |
| `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
| `restic_dir_group` | `'{{ansible_user}}'` | The group of all created dirs |
| `restic_no_log` | `true` | set to false to see hidden ansible logs |
| `restic_do_not_cleanup_cron ` | `false` | we changed the cron location and clean up the old one. You can skip the cleanup here |
| `restic__cache_config` | `false` | configure custom cache directory |
| `restic__cache_dir` | `'~/.cache/restic'` | define custom cache directory |
### Repos
Restic stores data in repositories. You have to specify at least one repository

View file

@ -24,5 +24,9 @@ restic_systemd_timer_default_OnCalendar: '*-*-* 02:00:00'
submodules_versioncheck: false
restic_do_not_cleanup_cron: false
# cache
restic__cache_config: false
restic__cache_dir: '~/.cache/restic'
# outdated variables because of irritating names, but kept for compatibility
restic_create_cron: false

View file

@ -23,8 +23,6 @@ fi
# your normal workflow here...
{% if item.disable_logging is defined and item.disable_logging %}
{% set backup_result_log, backup_output_log = "/dev/null", "/dev/null" %}
{% set forget_result_log, forget_output_log = "/dev/null", "/dev/null" %}
@ -38,6 +36,10 @@ fi
{% endif %}
{% endif %}
{% if restic__cache_config | bool -%}
export XDG_CACHE_HOME={{ restic__cache_dir }}
{% endif %}
export RESTIC_REPOSITORY={{ restic_repos[item.repo].location }}
export RESTIC_PASSWORD='{{ restic_repos[item.repo].password | regex_replace('\'', '\'\\\'\'') }}'
BACKUP_NAME={{ item.name }}

View file

@ -10,5 +10,5 @@ restic_os_variables:
paths:
- 'vars'
playbook_version_number: 22 # should be int
playbook_version_number: 23 # should be int
playbook_version_path: 'do1jlr.restic.version'