39 lines
1.8 KiB
Django/Jinja
39 lines
1.8 KiB
Django/Jinja
# Ansible Roles for managing Auengun.net Infrastructure & Testing/Learning.
|
|
# Source available at git.auengun.net/homelab/ansible-collection
|
|
# Copyright (C) 2023 GregoryDosh
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
# License, or (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
# SPDX-FileCopyrightText: 2023 GregoryDosh
|
|
|
|
[Unit]
|
|
Description=DCaaSS Docker System/Image/Volume Prune
|
|
Requires=docker.service
|
|
After=docker.service
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
User={{ DCAASS_CONFIG_USER_NAME }}
|
|
Group={{ DCAASS_CONFIG_GROUP_NAME }}
|
|
SyslogIdentifier={{ DCAASS_DOCKER_PRUNE_SERVICE_NAME }}
|
|
|
|
ExecStart=-{{ SH_BIN_ABSOLUTE_PATH }} -c '{{ DOCKER_BIN_ABSOLUTE_PATH }} system prune -af'
|
|
ExecStart=-{{ SH_BIN_ABSOLUTE_PATH }} -c '{{ DOCKER_BIN_ABSOLUTE_PATH }} buildx prune -a --filter=until=24h -f'
|
|
ExecStart=-{{ SH_BIN_ABSOLUTE_PATH }} -c '{{ DOCKER_BIN_ABSOLUTE_PATH }} image prune -a --filter=until=24h -f'
|
|
ExecStart=-{{ SH_BIN_ABSOLUTE_PATH }} -c '{{ DOCKER_BIN_ABSOLUTE_PATH }} images -qf "dangling=true" | {{ XARGS_BIN_ABSOLUTE_PATH }} -r {{ DOCKER_BIN_ABSOLUTE_PATH }} rmi -f || true'
|
|
ExecStart=-{{ SH_BIN_ABSOLUTE_PATH }} -c '{{ DOCKER_BIN_ABSOLUTE_PATH }} ps -aqf status=exited | {{ XARGS_BIN_ABSOLUTE_PATH }} -r {{ DOCKER_BIN_ABSOLUTE_PATH }} rm -v || true'
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|