35 lines
1.7 KiB
YAML
Raw Normal View History

#!/usr/bin/env ansible-playbook
# vim:ft=ansible:
---
2025-01-19 12:43:10 -06:00
# Install restic if we can
- name: install restic
block:
- name: install restic through apt
ansible.builtin.apt: name=restic state=present
when: ansible_pkg_mgr == "apt"
2025-01-19 12:54:00 -06:00
- name: install restic through rpm-ostree
community.general.rpm_ostree_pkg: name=restic state=present
when: ansible_os_family == "RedHat" and ansible_pkg_mgr == "atomic_container"
2025-01-19 12:43:10 -06:00
# The script
- name: template out backup script
2022-06-16 23:45:29 -05:00
ansible.builtin.template: src={{ backup_script }}.sh dest=/opt/backup.sh mode=0700 owner=root group=root
2025-01-19 12:43:10 -06:00
# Some restic-specific stuff
- name: template out restic password file
ansible.builtin.template: src={{ backup_script }}-password dest=/opt/restic-password mode=0700 owner=root group=root
- name: template out restic wrapper
ansible.builtin.template: src=restic-wrapper.sh dest=/opt/restic-wrapper mode=0700 owner=root group=root
# An analyzer for... reasons?
- name: template out analyze script
ansible.builtin.template: src={{ backup_script }}-analyze.sh dest=/opt/analyze.sh mode=0700 owner=root group=root
2025-01-19 12:43:10 -06:00
# This restore script doesn't even work???
- name: template out restore script
2022-06-16 23:45:29 -05:00
ansible.builtin.template: src={{ restore_script }}.sh dest=/opt/restore.sh mode=0700 owner=root group=root
2025-01-19 12:43:10 -06:00
# And service/timer definitions
- name: configure systemd service
2022-06-16 23:45:29 -05:00
ansible.builtin.template: src=backup.service dest=/etc/systemd/system/backup.service mode=0644
- name: configure systemd timer
2022-06-16 23:45:29 -05:00
ansible.builtin.template: src=backup.timer dest=/etc/systemd/system/backup.timer mode=0644
notify: restart backup timer
- name: enable timer
2022-06-16 23:45:29 -05:00
ansible.builtin.systemd: name=backup.timer state=started enabled=yes daemon_reload=yes