homeserver/roles/mgrote_rsync/tasks/source.yml
Michael Grote 16dd2e8993
Some checks failed
ansible-lint / gitleaks (pull_request) Successful in 7s
ansible-lint / Ansible Lint (pull_request) Failing after 1m25s
dsfg
2024-10-28 19:19:27 +01:00

76 lines
1.8 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: "0600"
with_items:
- "/etc/rsync_mirror/"
- "/etc/rsync_mirror/.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: true # tido
- name: Ensure SSH-Config is templated
become: true
ansible.builtin.template:
src: ssh-config.j2
dest: "/home/rsync_mirror/.ssh/config"
owner: "{{ rsync_mirror_user }}"
group: "{{ rsync_mirror_user_group }}"
mode: "0400"
- name: Ensure rsync_mirror-Script is templated
become: true
ansible.builtin.template:
src: "rsync_mirror.sh.j2"
dest: "/usr/bin/rsync_mirror.sh"
owner: root
group: root
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: true # todo umkehren
enabled: false # todo umkehren
loop:
- rsync_mirror.service
- rsync_mirror.timer
- rsync_mirror_mail.service