68 lines
1.6 KiB
YAML
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: 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: true # todo umkehren
|
|
enabled: false # todo umkehren
|
|
loop:
|
|
- rsync_mirror.service
|
|
- rsync_mirror.timer
|
|
- rsync_mirror_mail.service
|