homeserver/roles/mgrote_rsync/tasks/source.yml
Michael Grote bc6f8fdc9e
All checks were successful
ansible-lint / gitleaks (push) Successful in 5s
ansible-lint / Ansible Lint (push) Successful in 1m0s
add no_log as global variable (#233)
Reviewed-on: #233
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Co-committed-by: Michael Grote <michael.grote@posteo.de>
2024-11-10 15:56:59 +01:00

68 lines
1.6 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-Script is templated
become: true
ansible.builtin.template:
src: "rsync_mirror.sh.j2"
dest: "/usr/bin/rsync_mirror.sh"
owner: "{{ rsync_mirror_user }}"
group: "{{ rsync_mirror_user_group }}"
mode: "0750"
- 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