42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
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"
|
|
- "/opt/backups/modules"
|
|
- "{{ backups_outdir }}"
|
|
- name: Create /backups symlink
|
|
file:
|
|
state: link
|
|
path: "/backups"
|
|
src: "{{ backups_outdir }}"
|
|
- name: Template out backup script
|
|
template:
|
|
src: "backup.sh"
|
|
dest: "/opt/backups/backup.sh"
|
|
mode: "0700"
|
|
- name: Template out services
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode }}"
|
|
loop:
|
|
- { src: "9iron-backup.service", dest: "/etc/systemd/system/9iron-backup.service", mode: "0644" }
|
|
- { src: "9iron-backup.timer", dest: "/etc/systemd/system/9iron-backup.timer", mode: "0644" }
|
|
notify: restart backups timer
|
|
- name: Enable timer
|
|
systemd:
|
|
daemon_reload: yes
|
|
name: 9iron-backup.timer
|
|
enabled: yes
|
|
state: started
|
|
notify: restart backups timer
|
|
become: yes
|