homeserver/friedhof/mgrote_restic/tasks/main.yml
Michael Grote 170e788c9b remove restic (#648)
Reviewed-on: #648
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Co-committed-by: Michael Grote <michael.grote@posteo.de>
2024-01-26 14:04:22 +01:00

117 lines
2.6 KiB
YAML

---
- name: ensure group exists
become: true
ansible.builtin.group:
name: "{{ restic_group }}"
state: present
- name: install restic-packages
become: true
ansible.builtin.package:
name:
- restic
state: present
- name: create "{{ restic_conf_dir }}"
become: true
ansible.builtin.file:
path: "{{ restic_conf_dir }}"
state: directory
owner: "{{ restic_user }}"
group: "{{ restic_group }}"
mode: "0755"
- name: template smb.cred
become: true
ansible.builtin.template:
src: "smb.cred.j2"
dest: "{{ restic_conf_dir }}/smb.cred"
owner: "{{ restic_user }}"
group: "{{ restic_group }}"
mode: "0600"
no_log: true
- name: templates excludes
become: true
ansible.builtin.blockinfile:
path: "{{ restic_conf_dir }}/excludes"
create: true
block: "{{ restic_exclude }}"
mode: "0644"
owner: "{{ restic_user }}"
group: "{{ restic_group }}"
- name: template restic.env
become: true
ansible.builtin.template:
src: "restic.env.j2"
dest: "{{ restic_conf_dir }}/restic.env"
owner: root
group: root
mode: "0600"
no_log: true
- name: template restic.mount
become: true
ansible.builtin.template:
src: media-restic.mount.j2
dest: /etc/systemd/system/media-restic.mount # media-restic == /media/restic
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
- systemctl enable units
- name: template restic.automount
become: true
ansible.builtin.template:
src: media-restic.automount.j2
dest: /etc/systemd/system/media-restic.automount
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
- systemctl enable units
- systemctl start units
- name: template restic.service
become: true
ansible.builtin.template:
src: restic.service.j2
dest: /etc/systemd/system/restic.service
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
- name: template restic.timer
become: true
ansible.builtin.template:
src: restic.timer.j2
dest: /etc/systemd/system/restic.timer
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
- name: template restic_mail.service
become: true
ansible.builtin.template:
src: "restic_mail.service.j2"
dest: /etc/systemd/system/restic_mail.service
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
- name: systemctl start restic.timer
become: true
ansible.builtin.systemd:
name: restic.timer
state: started
enabled: true