This commit is contained in:
Michael Grote 2024-06-05 18:46:52 +02:00
parent c3012c032b
commit d7b52fb8de
5 changed files with 65 additions and 21 deletions

View file

@ -0,0 +1,28 @@
---
- name: systemctl daemon-reload
become: true
ansible.builtin.systemd:
daemon_reload: true
- name: systemctl enable units
become: true
ansible.builtin.systemd:
name: "{{ item }}"
enabled: true
masked: false
with_items:
- media-docker_housekeeping.automount
- media-docker_housekeeping.mount
- docker_housekeeping.service
- docker_housekeeping.timer
- docker_housekeeping_mail.service
- name: systemctl start units
become: true
ansible.builtin.systemd:
name: "{{ item }}"
state: restarted
enabled: true
with_items:
- docker_housekeeping.timer
notify: systemctl daemon-reload

View file

@ -1,7 +1,23 @@
--- ---
- name: Include LDAP tasks - name: template docker_housekeeping.service
ansible.builtin.include_tasks: ldap.yml become: true
ansible.builtin.template:
src: docker_housekeeping.service.j2
dest: /etc/systemd/system/docker_housekeeping.service
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
- name: Include User tasks - name: template docker_housekeeping.timer
ansible.builtin.include_tasks: admin.yml become: true
ansible.builtin.template:
src: docker_housekeeping.timer.j2
dest: /etc/systemd/system/docker_housekeeping.timer
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
... ...

View file

@ -0,0 +1,15 @@
{{ file_header | default () }}
[Unit]
Description=Backup with docker_housekeeping
Requires=media-docker_housekeeping.mount
After=media-docker_housekeeping.mount
OnFailure=docker_housekeeping_mail.service
[Service]
Type=simple
EnvironmentFile={{ docker_housekeeping_conf_dir }}/docker_housekeeping.env
ExecStart=/usr/bin/docker_housekeeping backup --one-file-system --no-cache --exclude-file {{ docker_housekeeping_conf_dir }}/excludes {{ docker_housekeeping_folders_to_backup }}
{# -iexclude-file Same as exclude-file but ignores cases like in --iexclude; https://docker_housekeeping.readthedocs.io/en/latest/040_backup.html #}
User={{ docker_housekeeping_user }}
Group={{ docker_housekeeping_group }}
RestartSec={{ docker_housekeeping_failure_delay }}

View file

@ -1,9 +1,9 @@
{{ file_header | default () }} {{ file_header | default () }}
[Unit] [Unit]
Description=Timer for restic backups. Description=Timer for docker_housekeeping backups.
[Timer] [Timer]
OnCalendar={{ restic_schedule }} OnCalendar={{ docker_housekeeping_schedule }}
RandomizedDelaySec=30 min RandomizedDelaySec=30 min
[Install] [Install]

View file

@ -1,15 +0,0 @@
{{ file_header | default () }}
[Unit]
Description=Backup with restic
Requires=media-restic.mount
After=media-restic.mount
OnFailure=restic_mail.service
[Service]
Type=simple
EnvironmentFile={{ restic_conf_dir }}/restic.env
ExecStart=/usr/bin/restic backup --one-file-system --no-cache --exclude-file {{ restic_conf_dir }}/excludes {{ restic_folders_to_backup }}
{# -iexclude-file Same as exclude-file but ignores cases like in --iexclude; https://restic.readthedocs.io/en/latest/040_backup.html #}
User={{ restic_user }}
Group={{ restic_group }}
RestartSec={{ restic_failure_delay }}