homeserver/roles/mgrote_zfs_sanoid/tasks/main.yml

76 lines
1.7 KiB
YAML
Raw Normal View History

---
- name: include user tasks
ansible.builtin.include_tasks: user.yml
- name: install packages from repo
become: true
ansible.builtin.apt:
name:
- mbuffer
- lzop
- libcapture-tiny-perl
- pv
2024-05-07 18:54:35 +02:00
- libconfig-ini-perl
- sanoid
state: present
2024-10-29 14:40:08 +01:00
- name: Overwrite syncoid script from package # todo
become: true
2024-10-29 14:40:08 +01:00
ansible.builtin.file:
dest: /usr/bin/syncoid
mode: '0755'
owner: root
group: root
2024-10-29 14:40:08 +01:00
state: absent
- name: create sanoid directories
become: true
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ sanoid_user }}"
group: "{{ sanoid_user_group }}"
mode: "0700"
with_items:
- "/etc/sanoid"
- "/etc/sanoid/.ssh"
- name: include snaps tasks
ansible.builtin.include_tasks: snaps.yml
when:
- sanoid_datasets is defined
- sanoid_templates is defined
- sanoid_snaps_enable is defined
- sanoid_snaps_enable
- name: ensure timers are enabled
become: true
ansible.builtin.systemd:
state: started
name: "{{ item }}"
daemon_reload: true
masked: false
enabled: true
loop:
- sanoid.timer
- name: ensure services are enabled
become: true
ansible.builtin.systemd:
name: "{{ item }}"
masked: false
enabled: true
loop:
- sanoid.service
- sanoid-prune.service
2024-10-29 14:37:47 +01:00
- name: include source-host tasks # todo
ansible.builtin.include_tasks: source.yml
when:
- sanoid_syncoid_source_host is defined and sanoid_syncoid_source_host is true
2024-10-29 14:37:47 +01:00
- name: include destination-host tasks # todo
ansible.builtin.include_tasks: destination.yml
when:
- sanoid_syncoid_destination_host is defined and sanoid_syncoid_destination_host is true