docker: add housekeeping #105

Merged
mg merged 12 commits from dhc into master 2024-06-05 18:58:29 +02:00
4 changed files with 8 additions and 18 deletions
Showing only changes of commit d8aa02e25c - Show all commits

View file

@ -0,0 +1,3 @@
---
docker_housekeeping_schedule:
...

View file

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

View file

@ -1,5 +1,5 @@
--- ---
- name: template docker_housekeeping.service - name: Setup docker housekeeping tasks
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: docker_housekeeping.service.j2 src: docker_housekeeping.service.j2
@ -10,7 +10,7 @@
notify: notify:
- systemctl daemon-reload - systemctl daemon-reload
- name: template docker_housekeeping.timer - name: Setup timer
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: docker_housekeeping.timer.j2 src: docker_housekeeping.timer.j2

View file

@ -1,15 +1,7 @@
{{ file_header | default () }} {{ file_header | default () }}
[Unit] [Unit]
Description=Backup with docker_housekeeping Description=Docker housekeeping tasks
Requires=media-docker_housekeeping.mount
After=media-docker_housekeeping.mount
OnFailure=docker_housekeeping_mail.service
[Service] [Service]
Type=simple Type=simple
EnvironmentFile={{ docker_housekeeping_conf_dir }}/docker_housekeeping.env ExecStart=/usr/bin/docker system prune --force
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 }}