mirror of
https://github.com/roles-ansible/ansible_role_restic.git
synced 2024-12-11 23:41:32 +01:00
Add option to limit maximum number of CPUs used.
This commit is contained in:
parent
1d7ba78515
commit
f283f55288
3 changed files with 30 additions and 19 deletions
14
README.md
14
README.md
|
@ -75,15 +75,17 @@ ansible-galaxy install do1jlr.restic
|
||||||
| `restic_log_dir` | `'{{ restic_script_dir }}/log'` | Location of the logs of the 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_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))* |
|
| `restic_backups` | `{}` (or `[]`) | A list of dictionaries specifying the files and directories to be backed up *(More Infos: [Backups](#Backups))* |
|
||||||
|`restic_create_schedule`| `false` | Should we schedule each backup. Either via cronjob or via systemd timer.|
|
|`restic_create_schedule` | `false` | Should we schedule each backup? Either via cronjob or via systemd timer. |
|
||||||
| `restic_schedule_type` | `systemd` | Here you can define if we create a ``cronjob`` or a ``systemd`` timer. If it fails to create a systemd timer, a cronjob will be created. |
|
| `restic_schedule_type` | `systemd` | Here you can define if we create a ``cronjob`` or a ``systemd`` timer. If it fails to create a systemd timer, a cronjob will be created. |
|
||||||
| `restic_dir_owner` | `'{{ansible_user}}'` | The owner of all created dirs |
|
| `restic_dir_owner` | `'{{ansible_user}}'` | The owner of all created dirs |
|
||||||
| `restic_dir_group` | `'{{ansible_user}}'` | The group of all created dirs |
|
| `restic_dir_group` | `'{{ansible_user}}'` | The group of all created dirs |
|
||||||
| `restic_no_log` | `true` | set to false to see hidden ansible logs |
|
| `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_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_config` | `false` | Configure custom cache directory |
|
||||||
| `restic__cache_dir` | `'~/.cache/restic'` | define custom cache directory |
|
| `restic__cache_dir` | `'~/.cache/restic'` | Define custom cache directory |
|
||||||
|`submodules_versioncheck`| `false` | if you set this variable to true, the role will run a [simple versionscheck](tasks/versioncheck.yml) to prevent running older versions of this role. |
|
|`submodules_versioncheck` | `false` | If you set this variable to true, the role will run a [simple versionscheck](tasks/versioncheck.yml) to prevent running older versions of this role. |
|
||||||
|
| `restic__limit_cpu_usage` | `false` | Should CPU usage be limited? |
|
||||||
|
| `restic__max_cpus` | `1` | Maximum number of CPUs that can be used simultaneously |
|
||||||
|
|
||||||
### Repos
|
### Repos
|
||||||
Restic stores data in repositories. You have to specify at least one repository
|
Restic stores data in repositories. You have to specify at least one repository
|
||||||
|
|
|
@ -27,5 +27,9 @@ restic_do_not_cleanup_cron: false
|
||||||
restic__cache_config: false
|
restic__cache_config: false
|
||||||
restic__cache_dir: '~/.cache/restic'
|
restic__cache_dir: '~/.cache/restic'
|
||||||
|
|
||||||
|
# limit maximum number of CPUs that can be used simultaneously
|
||||||
|
restic__limit_cpu_usage: false
|
||||||
|
restic__max_cpus: 1
|
||||||
|
|
||||||
# outdated variables because of irritating names, but kept for compatibility
|
# outdated variables because of irritating names, but kept for compatibility
|
||||||
restic_create_cron: false
|
restic_create_cron: false
|
||||||
|
|
|
@ -40,6 +40,11 @@ fi
|
||||||
export XDG_CACHE_HOME={{ restic__cache_dir }}
|
export XDG_CACHE_HOME={{ restic__cache_dir }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if restic__limit_cpu_usage | bool -%}
|
||||||
|
# Maximum number of CPUs used by restic is limited to {{ restic__max_cpus }}
|
||||||
|
export GOMAXPROCS={{ restic__max_cpus }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
export RESTIC_REPOSITORY={{ restic_repos[item.repo].location }}
|
export RESTIC_REPOSITORY={{ restic_repos[item.repo].location }}
|
||||||
export RESTIC_PASSWORD='{{ restic_repos[item.repo].password | regex_replace('\'', '\'\\\'\'') }}'
|
export RESTIC_PASSWORD='{{ restic_repos[item.repo].password | regex_replace('\'', '\'\\\'\'') }}'
|
||||||
BACKUP_NAME={{ item.name }}
|
BACKUP_NAME={{ item.name }}
|
||||||
|
|
Loading…
Reference in a new issue