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:
parent
f9ad4801c5
commit
6440710a3e
@ -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"
|
|
@ -9,18 +9,18 @@
|
|||||||
mode: "0700"
|
mode: "0700"
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
loop:
|
loop:
|
||||||
- "{{ backups_dir }}"
|
- "/opt/backups"
|
||||||
- "{{ backups_outdir }}"
|
- "/backups"
|
||||||
- "{{ backups_modulesdir }}"
|
- "/opt/backups/modules"
|
||||||
- name: Template out backup script
|
- name: Template out backup script
|
||||||
template:
|
template:
|
||||||
src: "backup.sh"
|
src: "backup.sh"
|
||||||
dest: "{{ backups_script }}"
|
dest: "/opt/backups/backup.sh"
|
||||||
mode: "0700"
|
mode: "0700"
|
||||||
- name: Set backup cronjob
|
- name: Set backup cronjob
|
||||||
cron:
|
cron:
|
||||||
minute: "0"
|
minute: "0"
|
||||||
hour: "2"
|
hour: "2"
|
||||||
name: ansible-backup
|
name: ansible-backup
|
||||||
job: "{{ backups_script }} >> {{ backups_outdir }}/backups.log 2>&1"
|
job: "/opt/backups/backup.sh >> /backups/backups.log 2>&1"
|
||||||
become: yes
|
become: yes
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
export BACKUPSDIR="{{ backups_outdir }}"
|
export BACKUPSDIR="/backups"
|
||||||
export MODULESDIR="{{ backups_modulesdir }}"
|
export MODULESDIR="/opt/backups/modules"
|
||||||
export DATE="$(date -Iseconds)"
|
export DATE="$(date -Iseconds)"
|
||||||
|
|
||||||
# Helper functions
|
# Helper functions
|
||||||
|
Loading…
Reference in New Issue
Block a user