misc/backup_files: Added & used variable for backup_target

Ensures usage of backup_name insted of domain
dehydrated
Felix Stupp 5 years ago
parent b6d9b1deb5
commit d1e14a9de9
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -4,12 +4,12 @@ set -euxo pipefail;
# Arguments # Arguments
path="$1"; path="$1";
name="$2"; target="$2";
# Variables # Variables
dir="$(dirname "$path")"; dir="$(dirname "$path")";
base="$(basename "$path")"; base="$(basename "$path")";
dest={{ backups_files_directory | quote }}"/$name/latest.tar.gpg"; dest="$target/latest.tar.gpg";
# Execution # Execution
tar --directory="$dir" --create --file=- "$base" | tar --directory="$dir" --create --file=- "$base" |

@ -3,6 +3,7 @@
# domain: backup.example # required if backup_name is not given # domain: backup.example # required if backup_name is not given
backup_name: "{{ domain }}" backup_name: "{{ domain }}"
backup_directory: "{{ global_webservers_directory }}/{{ backup_name }}" backup_directory: "{{ global_webservers_directory }}/{{ backup_name }}"
backup_target: "{{ backups_files_directory }}/{{ domain }}"
backup_script: "{{ backup_files_scripts_directory }}/{{ backup_name }}" backup_script: "{{ backup_files_scripts_directory }}/{{ backup_name }}"

@ -3,7 +3,7 @@
- name: Create directory for backups for files of {{ domain }} - name: Create directory for backups for files of {{ domain }}
file: file:
state: directory state: directory
path: "{{ backups_files_directory }}/{{ domain }}" path: "{{ backup_target }}"
owner: root owner: root
group: root group: root
mode: "u=rwx,g=rx,o=rx" mode: "u=rwx,g=rx,o=rx"

@ -4,6 +4,6 @@ set -eux;
{{ before_backup_command }} {{ before_backup_command }}
{{ global_helper_directory }}/backup_files.sh {{ backup_directory | quote }} {{ domain | quote }} {{ global_helper_directory }}/backup_files.sh {{ backup_directory | quote }} {{ backup_target | quote }}
{{ after_backup_command }} {{ after_backup_command }}

Loading…
Cancel
Save