ansible/roles/backups/tasks/main.yml
Salt 6440710a3e 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
2020-05-03 05:48:01 -05:00

27 lines
636 B
YAML

#!/usr/bin/ansible-playbook
# vim:ft=ansible:
---
- name: Set up general backups
block:
- name: Create backups directories
file:
state: directory
mode: "0700"
path: "{{ item }}"
loop:
- "/opt/backups"
- "/backups"
- "/opt/backups/modules"
- name: Template out backup script
template:
src: "backup.sh"
dest: "/opt/backups/backup.sh"
mode: "0700"
- name: Set backup cronjob
cron:
minute: "0"
hour: "2"
name: ansible-backup
job: "/opt/backups/backup.sh >> /backups/backups.log 2>&1"
become: yes