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
|
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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 }}
|
|
||||||
|
|
Loading…
Reference in a new issue