dfg
All checks were successful
ansible-lint / gitleaks (pull_request) Successful in 4s
ansible-lint / Ansible Lint (pull_request) Successful in 37s

This commit is contained in:
Michael Grote 2024-11-11 13:19:18 +01:00
parent 1f3c67019e
commit aab17f9df4
3 changed files with 12 additions and 5 deletions

View file

@ -22,14 +22,17 @@
mode: "0400"
no_log: "{{ no_debug | default('true') }}"
- name: Ensure rsync_mirror-Script is templated
- name: Ensure rsync_mirror-Scripts are templated
become: true
ansible.builtin.template:
src: "rsync_mirror.sh.j2"
dest: "/usr/bin/rsync_mirror.sh"
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

View file

@ -0,0 +1,5 @@
#!/bin/bash
{{ file_header | default () }}
/usr/bin/journalctl -u rsync_mirror.service -xe | grep -E '\-----------------------|Source:|Literal data:|matched data:|sent' | tail -n {{ rsync_mirror_dirs | length * 5 }} | mail -aFROM:{{ rsync_mirror_user }}@mgrote.net -s "rsync_mirror - %H" {{ my_mail }}
{# Anzahl der Elemente mal 5, da jeweils 5 Zeilen ausgegeben werden #}

View file

@ -5,5 +5,4 @@ Description=Send a Mail for rsync_mirror service after error or success rsync_mi
[Service]
Type=oneshot
{# Anzahl der Elemente mal 5, da jeweils 5 Zeilen ausgegeben werden #}
ExecStart=/bin/bash -c '/usr/bin/journalctl -u rsync_mirror.service -xe | grep -E '\-----------------------|Source:|Literal data:|matched data:|sent' | tail -n {{ rsync_mirror_dirs | length * 5 }} | mail -aFROM:{{ rsync_mirror_user }}@mgrote.net -s "rsync_mirror - %H" {{ my_mail }}'
ExecStart=/usr/bin/rsync_mirror_log.sh