Compare commits
No commits in common. "main" and "docs" have entirely different histories.
|
@ -1,11 +0,0 @@
|
||||||
# ---> Ansible
|
|
||||||
*.retry
|
|
||||||
plugins
|
|
||||||
library
|
|
||||||
|
|
||||||
# ---> Python
|
|
||||||
# Byte-compiled / optimized / DLL files
|
|
||||||
__pycache__/
|
|
||||||
*.py[cod]
|
|
||||||
*$py.class
|
|
||||||
|
|
15
.later.yml
15
.later.yml
|
@ -1,15 +0,0 @@
|
||||||
---
|
|
||||||
ansible:
|
|
||||||
custom_modules:
|
|
||||||
- iptables_raw
|
|
||||||
- openssl_pkcs12
|
|
||||||
- proxmox_kvm
|
|
||||||
- ucr
|
|
||||||
- corenetworks_dns
|
|
||||||
- corenetworks_token
|
|
||||||
|
|
||||||
rules:
|
|
||||||
exclude_files:
|
|
||||||
- "LICENSE*"
|
|
||||||
- "**/*.md"
|
|
||||||
- "**/*.ini"
|
|
|
@ -1,7 +0,0 @@
|
||||||
---
|
|
||||||
default: True
|
|
||||||
MD013: False
|
|
||||||
MD041: False
|
|
||||||
MD024: False
|
|
||||||
MD004:
|
|
||||||
style: dash
|
|
|
@ -1 +0,0 @@
|
||||||
LICENSE
|
|
|
@ -1,47 +0,0 @@
|
||||||
---
|
|
||||||
when:
|
|
||||||
- event: [pull_request]
|
|
||||||
- event: [push, manual]
|
|
||||||
branch:
|
|
||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: generate
|
|
||||||
image: quay.io/thegeeklab/ansible-doctor
|
|
||||||
environment:
|
|
||||||
ANSIBLE_DOCTOR_EXCLUDE_FILES: molecule/
|
|
||||||
ANSIBLE_DOCTOR_FORCE_OVERWRITE: "true"
|
|
||||||
ANSIBLE_DOCTOR_LOG_LEVEL: INFO
|
|
||||||
ANSIBLE_DOCTOR_ROLE_NAME: ${CI_REPO_NAME}
|
|
||||||
ANSIBLE_DOCTOR_TEMPLATE: readme
|
|
||||||
|
|
||||||
- name: format
|
|
||||||
image: quay.io/thegeeklab/alpine-tools
|
|
||||||
commands:
|
|
||||||
- prettier -w README.md
|
|
||||||
|
|
||||||
- name: diff
|
|
||||||
image: quay.io/thegeeklab/alpine-tools
|
|
||||||
commands:
|
|
||||||
- git diff --color=always README.md
|
|
||||||
|
|
||||||
- name: publish
|
|
||||||
image: quay.io/thegeeklab/wp-git-action
|
|
||||||
settings:
|
|
||||||
action:
|
|
||||||
- commit
|
|
||||||
- push
|
|
||||||
author_email: ci-bot@rknet.org
|
|
||||||
author_name: ci-bot
|
|
||||||
branch: main
|
|
||||||
message: "[skip ci] automated docs update"
|
|
||||||
netrc_machine: gitea.rknet.org
|
|
||||||
netrc_password:
|
|
||||||
from_secret: gitea_token
|
|
||||||
when:
|
|
||||||
- event: [push, manual]
|
|
||||||
branch:
|
|
||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- test
|
|
|
@ -1,30 +0,0 @@
|
||||||
---
|
|
||||||
when:
|
|
||||||
- event: [pull_request, tag]
|
|
||||||
- event: [push, manual]
|
|
||||||
branch:
|
|
||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: ansible-later
|
|
||||||
image: quay.io/thegeeklab/ansible-later:4
|
|
||||||
commands:
|
|
||||||
- ansible-later
|
|
||||||
environment:
|
|
||||||
FORCE_COLOR: "1"
|
|
||||||
|
|
||||||
- name: python-format
|
|
||||||
image: docker.io/python:3.12
|
|
||||||
commands:
|
|
||||||
- pip install -qq ruff
|
|
||||||
- ruff format --check --diff .
|
|
||||||
environment:
|
|
||||||
PY_COLORS: "1"
|
|
||||||
|
|
||||||
- name: python-lint
|
|
||||||
image: docker.io/python:3.12
|
|
||||||
commands:
|
|
||||||
- pip install -qq ruff
|
|
||||||
- ruff .
|
|
||||||
environment:
|
|
||||||
PY_COLORS: "1"
|
|
|
@ -1,26 +0,0 @@
|
||||||
---
|
|
||||||
when:
|
|
||||||
- event: [tag]
|
|
||||||
- event: [push, manual]
|
|
||||||
branch:
|
|
||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
|
||||||
|
|
||||||
runs_on: [success, failure]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: matrix
|
|
||||||
image: quay.io/thegeeklab/wp-matrix
|
|
||||||
settings:
|
|
||||||
homeserver:
|
|
||||||
from_secret: matrix_homeserver
|
|
||||||
password:
|
|
||||||
from_secret: matrix_password
|
|
||||||
roomid:
|
|
||||||
from_secret: matrix_roomid
|
|
||||||
username:
|
|
||||||
from_secret: matrix_username
|
|
||||||
when:
|
|
||||||
- status: [success, failure]
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- docs
|
|
|
@ -1,25 +0,0 @@
|
||||||
---
|
|
||||||
when:
|
|
||||||
- event: [pull_request, tag]
|
|
||||||
- event: [push, manual]
|
|
||||||
branch:
|
|
||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
|
||||||
|
|
||||||
variables:
|
|
||||||
- &molecule_base
|
|
||||||
image: quay.io/thegeeklab/molecule:6
|
|
||||||
group: molecule
|
|
||||||
secrets:
|
|
||||||
- source: molecule_hcloud_token
|
|
||||||
target: HCLOUD_TOKEN
|
|
||||||
environment:
|
|
||||||
PY_COLORS: "1"
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: molecule-default
|
|
||||||
<<: *molecule_base
|
|
||||||
commands:
|
|
||||||
- molecule test -s default
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- lint
|
|
21
LICENSE
21
LICENSE
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2022 Robert Kaussow <mail@thegeeklab.de>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is furnished
|
|
||||||
to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice (including the next
|
|
||||||
paragraph) shall be included in all copies or substantial portions of the
|
|
||||||
Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
|
||||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
||||||
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
@ -1,35 +0,0 @@
|
||||||
---
|
|
||||||
# @var dockertidy_image:description: Docker image to use.
|
|
||||||
dockertidy_image: thegeeklab/docker-tidy:latest
|
|
||||||
|
|
||||||
# @var dockertidy_interval:description: Interval for the systemd timer.
|
|
||||||
dockertidy_interval: daily
|
|
||||||
|
|
||||||
# @var dockertidy_dry_run:description: Only log actions, don't cleanup anything.
|
|
||||||
dockertidy_dry_run: False
|
|
||||||
|
|
||||||
# @var dockertidy_log_level:description: Current log level.
|
|
||||||
dockertidy_log_level: warning
|
|
||||||
|
|
||||||
# @var dockertidy_max_container_age:description: >
|
|
||||||
# Maximum age for a container, containers older than this age will be removed.
|
|
||||||
# @end
|
|
||||||
dockertidy_max_container_age: "5 days ago"
|
|
||||||
|
|
||||||
# @var dockertidy_max_image_age:description: >
|
|
||||||
# Maxium age for an image, images older than this age will be removed.
|
|
||||||
# @end
|
|
||||||
dockertidy_max_image_age: "3 days ago"
|
|
||||||
|
|
||||||
# @var dockertidy_dangling_volumes:description: Remove dangling volumes.
|
|
||||||
dockertidy_dangling_volumes: False
|
|
||||||
|
|
||||||
# @var dockertidy_exclude_image:description: Never remove images with this tag.
|
|
||||||
dockertidy_exclude_images: []
|
|
||||||
|
|
||||||
# @var dockertidy_exclude_container_label:description: >
|
|
||||||
# Never remove containers with this label `key` or label `key=value`.
|
|
||||||
# @end
|
|
||||||
dockertidy_exclude_container_labels: []
|
|
||||||
|
|
||||||
dockertidy_docker_socket_path: /var/run/docker.sock
|
|
|
@ -1,7 +0,0 @@
|
||||||
---
|
|
||||||
- name: Restart docker-tidy
|
|
||||||
ansible.builtin.service:
|
|
||||||
state: restarted
|
|
||||||
daemon_reload: True
|
|
||||||
name: tidy
|
|
||||||
listen: __tidy_restart
|
|
|
@ -1,13 +1,14 @@
|
||||||
# xoxys.docker_tidy
|
---
|
||||||
|
title: docker_tidy
|
||||||
|
type: docs
|
||||||
|
---
|
||||||
|
|
||||||
[![Build Status](https://ci.rknet.org/api/badges/ansible/xoxys.docker_tidy/status.svg)](https://ci.rknet.org/repos/ansible/xoxys.docker_tidy)
|
[![Source Code](https://img.shields.io/badge/gitea-source%20code-blue?logo=gitea&logoColor=white)](https://gitea.rknet.org/ansible/xoxys.docker_tidy) [![Build Status](https://img.shields.io/drone/build/ansible/xoxys.docker_tidy?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/ansible/xoxys.docker_tidy) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitea.rknet.org/ansible/xoxys.docker_tidy/src/branch/main/LICENSE)
|
||||||
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?label=license)](https://gitea.rknet.org/ansible/xoxys.docker_tidy/src/branch/main/LICENSE)
|
|
||||||
|
|
||||||
Setup docker-tidy garbage collector. Keep docker hosts small.
|
Setup docker-tidy garbage collector. Keep docker hosts small.
|
||||||
|
|
||||||
## Table of content
|
<!--more-->
|
||||||
|
|
||||||
- [Requirements](#requirements)
|
|
||||||
- [Default Variables](#default-variables)
|
- [Default Variables](#default-variables)
|
||||||
- [dockertidy_dangling_volumes](#dockertidy_dangling_volumes)
|
- [dockertidy_dangling_volumes](#dockertidy_dangling_volumes)
|
||||||
- [dockertidy_docker_socket_path](#dockertidy_docker_socket_path)
|
- [dockertidy_docker_socket_path](#dockertidy_docker_socket_path)
|
||||||
|
@ -22,15 +23,9 @@ Setup docker-tidy garbage collector. Keep docker hosts small.
|
||||||
- [dockertidy_max_container_age](#dockertidy_max_container_age)
|
- [dockertidy_max_container_age](#dockertidy_max_container_age)
|
||||||
- [dockertidy_max_image_age](#dockertidy_max_image_age)
|
- [dockertidy_max_image_age](#dockertidy_max_image_age)
|
||||||
- [Dependencies](#dependencies)
|
- [Dependencies](#dependencies)
|
||||||
- [License](#license)
|
|
||||||
- [Author](#author)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
- Minimum Ansible version: `2.10`
|
|
||||||
|
|
||||||
## Default Variables
|
## Default Variables
|
||||||
|
|
||||||
### dockertidy_dangling_volumes
|
### dockertidy_dangling_volumes
|
||||||
|
@ -135,14 +130,8 @@ Maxium age for an image, images older than this age will be removed.
|
||||||
dockertidy_max_image_age: 3 days ago
|
dockertidy_max_image_age: 3 days ago
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
None.
|
None.
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT
|
|
||||||
|
|
||||||
## Author
|
|
||||||
|
|
||||||
[Robert Kaussow](https://gitea.rknet.org/xoxys)
|
|
|
@ -1,26 +0,0 @@
|
||||||
---
|
|
||||||
galaxy_info:
|
|
||||||
# @meta author:value: [Robert Kaussow](https://gitea.rknet.org/xoxys)
|
|
||||||
author: Robert Kaussow <mail@thegeeklab.de>
|
|
||||||
namespace: xoxys
|
|
||||||
role_name: docker_tidy
|
|
||||||
# @meta description: >
|
|
||||||
# [![Build Status](https://ci.rknet.org/api/badges/ansible/xoxys.docker_tidy/status.svg)](https://ci.rknet.org/repos/ansible/xoxys.docker_tidy)
|
|
||||||
# [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?label=license)](https://gitea.rknet.org/ansible/xoxys.docker_tidy/src/branch/main/LICENSE)
|
|
||||||
#
|
|
||||||
# Setup docker-tidy garbage collector. Keep docker hosts small.
|
|
||||||
# @end
|
|
||||||
description: Setup docker-tidy garbage collector
|
|
||||||
license: MIT
|
|
||||||
min_ansible_version: "2.10"
|
|
||||||
platforms:
|
|
||||||
- name: EL
|
|
||||||
versions:
|
|
||||||
- "9"
|
|
||||||
galaxy_tags:
|
|
||||||
- docker
|
|
||||||
- tidy
|
|
||||||
- gc
|
|
||||||
dependencies: []
|
|
||||||
collections:
|
|
||||||
- community.general
|
|
|
@ -1,6 +0,0 @@
|
||||||
---
|
|
||||||
- name: Converge
|
|
||||||
hosts: all
|
|
||||||
roles:
|
|
||||||
- role: xoxys.dockerengine
|
|
||||||
- role: xoxys.docker_tidy
|
|
|
@ -1,17 +0,0 @@
|
||||||
---
|
|
||||||
driver:
|
|
||||||
name: molecule_hetznercloud
|
|
||||||
dependency:
|
|
||||||
name: galaxy
|
|
||||||
options:
|
|
||||||
role-file: molecule/requirements.yml
|
|
||||||
requirements-file: molecule/requirements.yml
|
|
||||||
platforms:
|
|
||||||
- name: "rocky9-docker-tidy"
|
|
||||||
server_type: "cx11"
|
|
||||||
image: "rocky-9"
|
|
||||||
provisioner:
|
|
||||||
name: ansible
|
|
||||||
log: False
|
|
||||||
verifier:
|
|
||||||
name: testinfra
|
|
|
@ -1,11 +0,0 @@
|
||||||
---
|
|
||||||
- name: Prepare
|
|
||||||
hosts: all
|
|
||||||
gather_facts: False
|
|
||||||
tasks:
|
|
||||||
- name: Bootstrap Python for Ansible
|
|
||||||
ansible.builtin.raw: |
|
|
||||||
command -v python3 python ||
|
|
||||||
((test -e /usr/bin/apt && (apt -y update && apt install -y python-minimal)) ||
|
|
||||||
echo "Warning: Python not boostrapped due to unknown platform.")
|
|
||||||
changed_when: False
|
|
|
@ -1,14 +0,0 @@
|
||||||
import os
|
|
||||||
|
|
||||||
import testinfra.utils.ansible_runner
|
|
||||||
|
|
||||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|
||||||
os.environ["MOLECULE_INVENTORY_FILE"]
|
|
||||||
).get_hosts("all")
|
|
||||||
|
|
||||||
|
|
||||||
def test_tidy_running_and_enabled(host):
|
|
||||||
service = host.service("tidy.timer")
|
|
||||||
|
|
||||||
assert service.is_running
|
|
||||||
assert service.is_enabled
|
|
|
@ -1,12 +0,0 @@
|
||||||
---
|
|
||||||
collections: []
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- src: https://gitea.rknet.org/ansible/xoxys.python3.git
|
|
||||||
name: xoxys.python3
|
|
||||||
scm: git
|
|
||||||
version: main
|
|
||||||
- src: https://gitea.rknet.org/ansible/xoxys.dockerengine.git
|
|
||||||
name: xoxys.dockerengine
|
|
||||||
scm: git
|
|
||||||
version: main
|
|
|
@ -1,17 +0,0 @@
|
||||||
[tool.ruff]
|
|
||||||
exclude = [".git", "__pycache__"]
|
|
||||||
|
|
||||||
line-length = 99
|
|
||||||
indent-width = 4
|
|
||||||
|
|
||||||
[tool.ruff.lint]
|
|
||||||
ignore = ["W191", "E111", "E114", "E117", "S101", "S105"]
|
|
||||||
select = ["F", "E", "I", "W", "S"]
|
|
||||||
|
|
||||||
[tool.ruff.format]
|
|
||||||
quote-style = "double"
|
|
||||||
indent-style = "space"
|
|
||||||
line-ending = "lf"
|
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
|
||||||
filterwarnings = ["ignore::FutureWarning", "ignore::DeprecationWarning"]
|
|
|
@ -1,28 +0,0 @@
|
||||||
---
|
|
||||||
- name: Write environment file
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: etc/sysconfig/tidy.j2
|
|
||||||
dest: /etc/sysconfig/tidy
|
|
||||||
mode: "0600"
|
|
||||||
notify: __tidy_restart
|
|
||||||
|
|
||||||
- name: Write timer file
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: etc/systemd/system/tidy.timer.j2
|
|
||||||
dest: /etc/systemd/system/tidy.timer
|
|
||||||
mode: "0644"
|
|
||||||
notify: __tidy_restart
|
|
||||||
|
|
||||||
- name: Write service file
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: etc/systemd/system/tidy.service.j2
|
|
||||||
dest: /etc/systemd/system/tidy.service
|
|
||||||
mode: "0644"
|
|
||||||
notify: __tidy_restart
|
|
||||||
|
|
||||||
- name: Ensure dockertidy timer is up and running
|
|
||||||
ansible.builtin.service:
|
|
||||||
name: tidy.timer
|
|
||||||
daemon_reload: True
|
|
||||||
enabled: True
|
|
||||||
state: started
|
|
|
@ -1,11 +0,0 @@
|
||||||
#jinja2:lstrip_blocks: True
|
|
||||||
{{ ansible_managed | comment }}
|
|
||||||
TIDY_DRY_RUN={{ dockertidy_dry_run }}
|
|
||||||
TIDY_HTTP_TIMEOUT=60
|
|
||||||
TIDY_LOG_LEVEL={{ dockertidy_log_level }}
|
|
||||||
TIDY_LOG_JSON=False
|
|
||||||
TIDY_GC_MAX_CONTAINER_AGE="{{ dockertidy_max_container_age }}"
|
|
||||||
TIDY_GC_MAX_IMAGE_AGE="{{ dockertidy_max_image_age }}"
|
|
||||||
TIDY_GC_DANGLING_VOLUMES={{ dockertidy_dangling_volumes }}
|
|
||||||
TIDY_GC_EXCLUDE_IMAGES={{ dockertidy_exclude_images | join(",") }}
|
|
||||||
TIDY_GC_EXCLUDE_CONTAINER_LABELS={{ dockertidy_exclude_container_labels | join(",") }}
|
|
|
@ -1,24 +0,0 @@
|
||||||
#jinja2:lstrip_blocks: True
|
|
||||||
{{ ansible_managed | comment }}
|
|
||||||
[Unit]
|
|
||||||
Description=Docker GC
|
|
||||||
Requires=docker.service network-online.target
|
|
||||||
After=docker.service network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
|
|
||||||
ExecStartPre=/bin/sh -c '/usr/bin/docker ps | /bin/grep %p 1> /dev/null && /usr/bin/docker kill %p || true'
|
|
||||||
ExecStartPre=/bin/sh -c '/usr/bin/docker ps -a | /bin/grep %p 1> /dev/null && /usr/bin/docker rm %p || true'
|
|
||||||
ExecStartPre=/usr/bin/docker pull {{ dockertidy_image }}
|
|
||||||
ExecStart=/usr/bin/docker run --rm \
|
|
||||||
--name %p \
|
|
||||||
--hostname %p \
|
|
||||||
--env-file /etc/sysconfig/tidy \
|
|
||||||
--volume {{ dockertidy_docker_socket_path }}:/var/run/docker.sock \
|
|
||||||
--privileged=true \
|
|
||||||
--userns=host \
|
|
||||||
{{ dockertidy_image }} \
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,9 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Docker GC
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnCalendar={{ dockertidy_interval }}
|
|
||||||
Persistent=true
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
Loading…
Reference in New Issue