Ansible_workstation/tasks/dd_backup.yml

48 lines
987 B
YAML

---
- name: Install autofs
pacman:
name: borg
state: present
- name: mkdir for config files and scripts
file:
path: /etc/backups
state: directory
- name: copy udev rule in /etc/backups
copy:
src: files/dd_borg/40-backup.rules
dest: /etc/backups/40-backup.rules
backup: yes
- name: Link it to /etc/udev
file:
src: /etc/backups/40-backup.rules
dest: /etc/udev/rules.d/40-backup.rules
state: link
- name: copy service in /etc/backups
copy:
src: files/dd_borg/automatic-backup.service
dest: /etc/backups/automatic-backup.service
backup: yes
- name: Link it to /etc/udev
file:
src: /etc/backups/automatic-backup.service
dest: /etc/systemd/system/automatic-backup.service
state: link
- name: copy run script
template:
src: files/dd_borg/run.sh
dest: /etc/backups/run.sh
mode: u+rxw
- name: Reload systemctl
systemd:
daemon_reload: yes
- name: Reload udev
shell: udevadm control --reload