homeserver/roles/mgrote_rsync/tasks/source.yml

70 lines
1.4 KiB
YAML
Raw Normal View History

2024-10-28 18:17:23 +01:00
---
2024-10-28 18:24:29 +01:00
- name: Ensure packages are present
2024-10-28 18:17:23 +01:00
become: true
2024-10-28 18:24:29 +01:00
ansible.builtin.package:
name:
- rsync
2024-10-28 18:17:23 +01:00
state: present
2024-10-28 18:24:29 +01:00
- name: Ensure needed dirs exist
2024-10-28 18:17:23 +01:00
become: true
2024-10-28 18:24:29 +01:00
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ sanoid_user }}"
group: "{{ sanoid_user_group }}"
mode: "0600"
with_items:
- "/etc/rsync_mirror/"
- "/etc/rsync_mirror/.ssh"
- name: template syncoid.sh
become: true
ansible.builtin.template:
src: "syncoid.sh.j2"
dest: /usr/bin/syncoid.sh
owner: root
group: root
mode: "0755"
2024-10-28 18:17:23 +01:00
when:
2024-10-28 18:24:29 +01:00
- sanoid_syncoid_destination_host
- name: Ensure services are present
become: true
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
loop:
- youtubedl.service
- youtubedl.timer
- youtubedl_mail.service
when: ytdl_active
- name: Ensure timer unit is enabled
become: true
ansible.builtin.systemd:
name: youtubedl.timer
enabled: true
masked: false
state: started
notify:
- systemctl daemon-reload
when: ytdl_active
- name: Ensure service units are enabled
become: true
ansible.builtin.systemd:
name: "{{ item }}"
masked: false
enabled: true
loop:
- youtubedl.service
- youtubedl.timer
- youtubedl_mail.service
when: ytdl_active