Ansible role for preparing a host for Docker Containers
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Simon Cornet a1d2023818
All checks were successful
ci/woodpecker/push/linting Pipeline was successful
docs: improve readme
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-05 17:27:49 +02:00
.woodpecker chore(package): update cr.simoncor.net/dockerhub/davidanson/markdownlint-cli2 docker tag to v0.23.3 2026-09-20 05:47:13 +00:00
defaults fix: trailing spaces 2025-10-03 12:00:19 +02:00
handlers feat: initial commit 2025-10-03 11:59:26 +02:00
meta feat: initial commit 2025-10-03 11:59:26 +02:00
roles ci: migrate from gitlab ci to woodpecker 2026-05-15 14:31:03 +02:00
tasks style: task name 2026-08-13 08:03:24 +02:00
.ansible-lint fix: exclude only sops yml files from lint 2026-07-14 16:23:38 +02:00
.editorconfig chore: add .editorconfig and .gitattributes 2026-05-27 14:23:43 +02:00
.gitattributes chore: add .editorconfig and .gitattributes 2026-05-27 14:23:43 +02:00
.gitignore feat: initial commit 2025-10-03 11:59:26 +02:00
.markdownlint-cli2.jsonc ci: migrate from gitlab ci to woodpecker 2026-05-15 14:31:03 +02:00
.sops.yaml fix: correct sops regex to ya?ml 2026-07-14 16:01:45 +02:00
.yamllint chore: exclude .yml files from lint configs 2026-07-14 16:17:22 +02:00
AGENTS.md chore: add AGENTS.md for opencode agents 2026-02-16 10:06:22 +01:00
ansible.cfg chore: sync linting and config files from common 2026-07-14 11:33:15 +02:00
playbook.yaml chore(playbook): run galaxy install only on first host 2026-08-13 08:49:03 +02:00
readme.md docs: improve readme 2026-10-05 17:27:49 +02:00
renovate.json feat: initial commit 2025-10-03 11:59:26 +02:00

Ansible Role: Docker

Install and configure the Docker container runtime. On Debian the role installs Docker CE from the official Docker apt repository, on Alpine it installs the distribution packages.

Requirements

Operating System Notes
Debian Docker CE from download.docker.com (deb822 repository, amd64 or arm64)
Alpine docker, docker-compose and py3-docker-py from apk

The role has no role dependencies (meta/main.yaml).

Variables

Variable Required Default Description
type No "" Object type. Defined in the defaults, but currently not referenced by any task (see below).

The AppArmor removal is not controlled by type: it runs whenever the host reports ansible_facts["virtualization_type"] == "lxc".

Example

type: "server"

What the role does

  1. On LXC guests, purge the apparmor package (Debian only) and reboot the guest through the reboot container handler. Handlers are flushed before Docker is installed.
  2. Alpine: install docker, docker-compose and py3-docker-py, then start and enable the docker service.
  3. Debian:
    • purge the old containerd, docker-compose, docker-doc, docker.io, podman-docker and runc packages;
    • download the Docker GPG key to /etc/apt/keyrings/docker.asc;
    • remove the legacy /etc/apt/sources.list.d/docker.list (marked in the code for removal after 2026-10-20);
    • add the docker deb822 repository (stable component);
    • install containerd.io, docker-ce, docker-ce-cli, docker-compose-plugin, python3-pip, python3-docker and nfs-common.

Usage

Run playbook.yaml through Semaphore. The playbook first runs ansible-galaxy install -f -r roles/requirements.yml on the controller (works around a Semaphore bug) and then includes the docker role on all hosts with become.

The role is also used as a dependency by other playbooks (for example forgejo and grafana).