Add support for restic_dump_compression_enabled
This commit is contained in:
parent
008b54356b
commit
ac87edb0b6
4 changed files with 7 additions and 1 deletions
|
@ -23,6 +23,7 @@ If you want to force the installation, overwrite the binary or update restic, yo
|
||||||
- `restic_check`: run `restic check` as `ExecStartPre` if true (`false`)
|
- `restic_check`: run `restic check` as `ExecStartPre` if true (`false`)
|
||||||
- `restic_default_folders`: a default list of folders that restic will backup (`/etc/`, `/root` and `/var/log`)
|
- `restic_default_folders`: a default list of folders that restic will backup (`/etc/`, `/root` and `/var/log`)
|
||||||
- `restic_folders`: the list of folder you want to backup
|
- `restic_folders`: the list of folder you want to backup
|
||||||
|
- `restic_dump_compression_enabled`: enable piping to pigz for database dumps
|
||||||
|
|
||||||
Each folder has a `path` and an `exclude` property (which defaults to nothing). The `exclude` property is the literal argument passed to restic (exemple: `--exclude .cache --exclude .local`).
|
Each folder has a `path` and an `exclude` property (which defaults to nothing). The `exclude` property is the literal argument passed to restic (exemple: `--exclude .cache --exclude .local`).
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ restic_default_folders:
|
||||||
- {path: '/root', exclude: '--exclude .cache --exclude .local'}
|
- {path: '/root', exclude: '--exclude .cache --exclude .local'}
|
||||||
restic_folders: []
|
restic_folders: []
|
||||||
restic_databases: []
|
restic_databases: []
|
||||||
|
restic_dump_compression_enabled: false
|
||||||
restic_forget: true
|
restic_forget: true
|
||||||
restic_forget_keep_within: 30d
|
restic_forget_keep_within: 30d
|
||||||
restic_prune: true
|
restic_prune: true
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
apt:
|
apt:
|
||||||
name: bzip2
|
name: bzip2
|
||||||
|
|
||||||
|
- name: Install pigz (to compress db dumps)
|
||||||
|
apt:
|
||||||
|
name: pigz
|
||||||
|
|
||||||
- name: Download restic
|
- name: Download restic
|
||||||
get_url:
|
get_url:
|
||||||
url: 'https://github.com/restic/restic/releases/download/v{{ restic_version }}/restic_{{ restic_version }}_linux_amd64.bz2'
|
url: 'https://github.com/restic/restic/releases/download/v{{ restic_version }}/restic_{{ restic_version }}_linux_amd64.bz2'
|
||||||
|
|
|
@ -25,7 +25,7 @@ ExecStart={{ restic_path }} backup --verbose {{ folder.path }} {{ folder.exclude
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
|
|
||||||
{% for database in restic_databases %}
|
{% for database in restic_databases %}
|
||||||
ExecStart=/bin/sh -c "{{ database.dump_command }} | {{ restic_path }} backup --verbose --stdin --stdin-filename {{ database.name }}.sql"
|
ExecStart=/bin/sh -c "{{ database.dump_command }} {{ '| pigz |' if restic_dump_compression_enabled else '|' }} {{ restic_path }} backup --verbose --stdin --stdin-filename {{ database.name }}{{ '.sql.gz' if restic_dump_compression_enabled else '.sql' }}"
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
|
|
||||||
{% if restic_forget %}
|
{% if restic_forget %}
|
||||||
|
|
Loading…
Reference in a new issue