From 14126768fdaaed548f26f753640e90bbdf158813 Mon Sep 17 00:00:00 2001 From: beechesII Date: Thu, 8 Feb 2024 11:39:05 +0100 Subject: [PATCH] added new variable restic_backup_script_shell, to make shell to use for backup script configurable --- README.md | 1 + defaults/main.yml | 1 + tasks/run_backup.yml | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d0365b..ac12f0a 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ ansible-galaxy install roles-ansible.restic | `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_backup_script_shell` | `sh` | Shell to use for run of backup script | | `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))* | diff --git a/defaults/main.yml b/defaults/main.yml index b04a487..aef63a4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -4,6 +4,7 @@ restic_version: '0.16.3' restic_download_path: '/opt/restic' restic_install_path: '/usr/local/bin' restic_script_dir: '/opt/restic' +restic_backup_script_shell: sh restic_log_dir: '{{ restic_script_dir }}/log' restic_repos: {} restic_backups: [] diff --git a/tasks/run_backup.yml b/tasks/run_backup.yml index abbcce9..943972e 100644 --- a/tasks/run_backup.yml +++ b/tasks/run_backup.yml @@ -1,7 +1,7 @@ --- - name: (RUN BACKUP) Run backup script ansible.builtin.command: - cmd: "/usr/bin/env sh {{ restic_script_dir }}/backup-{{ item.name | replace(' ', '') }}.sh" + cmd: "/usr/bin/env {{ restic_backup_script_shell }} {{ restic_script_dir }}/backup-{{ item.name | replace(' ', '') }}.sh" no_log: "{{ restic_no_log }}" with_items: '{{ restic_backups }}' when: