Hardcode backups directories

Unless I make these playbook-wide variables, there's no real way to configure them at runtime. Best to just hardcode them, I suppose
This commit is contained in:
Salt 2020-05-03 05:48:01 -05:00
parent f9ad4801c5
commit 6440710a3e
3 changed files with 7 additions and 12 deletions

View File

@ -1,5 +0,0 @@
# vim:ft=ansible:
backups_dir: "/opt/backups"
backups_outdir: "/backups"
backups_modulesdir: "/opt/backups/modules"
backups_script: "/opt/backups/backup.sh"

View File

@ -9,18 +9,18 @@
mode: "0700"
path: "{{ item }}"
loop:
- "{{ backups_dir }}"
- "{{ backups_outdir }}"
- "{{ backups_modulesdir }}"
- "/opt/backups"
- "/backups"
- "/opt/backups/modules"
- name: Template out backup script
template:
src: "backup.sh"
dest: "{{ backups_script }}"
dest: "/opt/backups/backup.sh"
mode: "0700"
- name: Set backup cronjob
cron:
minute: "0"
hour: "2"
name: ansible-backup
job: "{{ backups_script }} >> {{ backups_outdir }}/backups.log 2>&1"
job: "/opt/backups/backup.sh >> /backups/backups.log 2>&1"
become: yes

View File

@ -9,8 +9,8 @@
set -e
export BACKUPSDIR="{{ backups_outdir }}"
export MODULESDIR="{{ backups_modulesdir }}"
export BACKUPSDIR="/backups"
export MODULESDIR="/opt/backups/modules"
export DATE="$(date -Iseconds)"
# Helper functions