homeserver/friedhof/mgrote_zfs_sanoid_mit_syncoid/tasks/main.yml
Michael Grote 7a2ccbabb6
All checks were successful
ansible-lint / gitleaks (push) Successful in 2s
ansible-lint / Ansible Lint (push) Successful in 23s
remove syncoid, switch to rsync (#221)
no more zfs send
mirroring with rsync
snaps an both sides

Reviewed-on: #221
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Co-committed-by: Michael Grote <michael.grote@posteo.de>
2024-10-31 12:01:46 +01:00

78 lines
1.8 KiB
YAML

---
- 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
- libconfig-ini-perl
- sanoid
state: present
- name: Overwrite syncoid script from package
become: true
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/jimsalterjrs/sanoid/master/syncoid
dest: /usr/bin/syncoid
mode: '0755'
owner: root
group: root
force: true
- 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
- name: include source-host tasks
ansible.builtin.include_tasks: source.yml
when:
- sanoid_syncoid_source_host is defined and sanoid_syncoid_source_host is true
- sanoid_syncoid_ssh_pubkey is defined
- name: include destination-host tasks
ansible.builtin.include_tasks: destination.yml
when:
- sanoid_syncoid_destination_host is defined and sanoid_syncoid_destination_host is true
- sanoid_syncoid_ssh_privkey is defined