Compare commits

...

5 commits

Author SHA1 Message Date
11a0845bfa playbook
Some checks failed
ci/woodpecker/push/gitleaks Pipeline was successful
ci/woodpecker/push/ansible-lint Pipeline failed
2024-06-05 18:51:32 +02:00
d8aa02e25c f 2024-06-05 18:51:11 +02:00
d7b52fb8de rename 2024-06-05 18:46:52 +02:00
c3012c032b add unots 2024-06-05 18:45:30 +02:00
e99d5d98c0 add role 2024-06-05 18:44:57 +02:00
6 changed files with 69 additions and 0 deletions

View file

@ -19,3 +19,6 @@
- role: mgrote_docker_compose_inline
tags: "compose"
become: true
- role: mgrote_docker_housekeeping
tags: "housekeeping"
become: true

View file

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

View file

@ -0,0 +1,23 @@
---
- 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:
- docker_housekeeping.service
- docker_housekeeping.timer
- name: systemctl start units
become: true
ansible.builtin.systemd:
name: docker_housekeeping.timer
state: restarted
enabled: true
notify: systemctl daemon-reload

View file

@ -0,0 +1,23 @@
---
- name: Setup docker housekeeping tasks
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: Setup timer
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,7 @@
{{ file_header | default () }}
[Unit]
Description=Docker housekeeping tasks
[Service]
Type=simple
ExecStart=/usr/bin/docker system prune --force

View file

@ -0,0 +1,10 @@
{{ file_header | default () }}
[Unit]
Description=Timer for docker_housekeeping backups.
[Timer]
OnCalendar={{ docker_housekeeping_schedule }}
RandomizedDelaySec=30 min
[Install]
WantedBy=timers.target multi-user.target