docker: add housekeeping #105
4 changed files with 8 additions and 18 deletions
3
roles/mgrote_docker_housekeeping/defaults/main.yml
Normal file
3
roles/mgrote_docker_housekeeping/defaults/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
docker_housekeeping_schedule:
|
||||
...
|
|
@ -11,18 +11,13 @@
|
|||
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 }}"
|
||||
name: docker_housekeeping.timer
|
||||
state: restarted
|
||||
enabled: true
|
||||
with_items:
|
||||
- docker_housekeeping.timer
|
||||
notify: systemctl daemon-reload
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: template docker_housekeeping.service
|
||||
- name: Setup docker housekeeping tasks
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: docker_housekeeping.service.j2
|
||||
|
@ -10,7 +10,7 @@
|
|||
notify:
|
||||
- systemctl daemon-reload
|
||||
|
||||
- name: template docker_housekeeping.timer
|
||||
- name: Setup timer
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: docker_housekeeping.timer.j2
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
{{ file_header | default () }}
|
||||
[Unit]
|
||||
Description=Backup with docker_housekeeping
|
||||
Requires=media-docker_housekeeping.mount
|
||||
After=media-docker_housekeeping.mount
|
||||
OnFailure=docker_housekeeping_mail.service
|
||||
Description=Docker housekeeping tasks
|
||||
|
||||
[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 }}
|
||||
ExecStart=/usr/bin/docker system prune --force
|
||||
|
|
Loading…
Reference in a new issue