mirror of
https://github.com/roles-ansible/ansible_role_restic.git
synced 2024-12-11 23:41:32 +01:00
Added option to run backup script immediately
This commit is contained in:
parent
ce731567bf
commit
4740ebb5d3
3 changed files with 30 additions and 21 deletions
|
@ -66,7 +66,7 @@ ansible-galaxy install do1jlr.restic
|
||||||
## Role Variables
|
## Role Variables
|
||||||
|
|
||||||
| Name | Default | Description |
|
| Name | Default | Description |
|
||||||
| ---------------------- | ----------------------------------- | --------------------------------------------------------------------------- |
|
|-------------------------------|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `restic_url` | `undefined` | The URL to download restic from. Use this variable to overwrite the default |
|
| `restic_url` | `undefined` | The URL to download restic from. Use this variable to overwrite the default |
|
||||||
| `restic_version` | `'0.15.1'` | The version of Restic to install |
|
| `restic_version` | `'0.15.1'` | The version of Restic to install |
|
||||||
| `restic_download_path` | `'/opt/restic'` | Download location for the restic binary |
|
| `restic_download_path` | `'/opt/restic'` | Download location for the restic binary |
|
||||||
|
@ -76,6 +76,7 @@ ansible-galaxy install do1jlr.restic
|
||||||
| `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_backup_now` | `false` | Whether or not the backup script should be run immediately |
|
||||||
| `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 |
|
||||||
|
|
|
@ -33,3 +33,7 @@
|
||||||
distribution: '{{ ansible_distribution }}'
|
distribution: '{{ ansible_distribution }}'
|
||||||
distribution_version: '{{ ansible_distribution_version }}'
|
distribution_version: '{{ ansible_distribution_version }}'
|
||||||
distribution_major_version: '{{ ansible_distribution_major_version }}'
|
distribution_major_version: '{{ ansible_distribution_major_version }}'
|
||||||
|
|
||||||
|
- name: Run backups now
|
||||||
|
ansible.builtin.include_tasks: 'run_backup.yml'
|
||||||
|
when: restic_backup_now | bool
|
||||||
|
|
4
tasks/run_backup.yml
Normal file
4
tasks/run_backup.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
- name: (RUN BACKUP) Run backup script
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: "{{ restic_script_dir }}/backup-{{ item.name | replace(' ', '') }}.sh"
|
Loading…
Reference in a new issue