homeserver/roles/mgrote_rsync/tasks/source.yml
Michael Grote aab17f9df4
All checks were successful
ansible-lint / gitleaks (pull_request) Successful in 4s
ansible-lint / Ansible Lint (pull_request) Successful in 37s
dfg
2024-11-11 13:19:18 +01:00

71 lines
1.7 KiB
YAML

---
- name: Ensure needed dirs exist
become: true
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ rsync_mirror_user }}"
group: "{{ rsync_mirror_user_group }}"
mode: "0700"
with_items:
- "/etc/rsync_mirror/"
- "/etc/rsync_mirror/.ssh"
- "/home/{{ rsync_mirror_user }}/.ssh"
- name: Ensure SSH-Private-Key is templated
become: true
ansible.builtin.template:
src: private_key.j2
dest: "/etc/rsync_mirror/.ssh/id_rsync_mirror"
owner: "{{ rsync_mirror_user }}"
group: "{{ rsync_mirror_user_group }}"
mode: "0400"
no_log: "{{ no_debug | default('true') }}"
- name: Ensure rsync_mirror-Scripts are templated
become: true
ansible.builtin.template:
src: "{{ item }}.sh.j2"
dest: "/usr/bin/{{ item }}.sh"
owner: "{{ rsync_mirror_user }}"
group: "{{ rsync_mirror_user_group }}"
mode: "0750"
loop:
- rsync_mirror
- rsync_mirror_log
- 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:
- rsync_mirror.service
- rsync_mirror.timer
- rsync_mirror_mail.service
- name: Ensure timer unit is enabled
become: true
ansible.builtin.systemd:
name: rsync_mirror.timer
enabled: true
masked: false
state: started
notify:
- systemctl daemon-reload
- name: Ensure service units are enabled
become: true
ansible.builtin.systemd:
name: "{{ item }}"
masked: false
enabled: true
loop:
- rsync_mirror.service
- rsync_mirror.timer
- rsync_mirror_mail.service