Files
Kamino/roles/docker/defaults/main.yml
T
Dragonish 887302b208
Build / build (pull_request) Successful in 51s
Molecule / molecule (pull_request) Canceled after 0s
Lint / lint (pull_request) Canceled after 1m20s
feat(docker): manage /etc/docker/daemon.json (live-restore, log driver, extra options)
Adds docker_daemon_options, docker_live_restore, docker_log_driver,
docker_log_max_size, docker_log_max_file and docker_daemon_restart.

The file is written, before the packages are installed, only when one of
the first five is set, so a host that sets none is unchanged; the role
then owns the whole file. It restarts dockerd only when
docker_daemon_restart is true, because a restart with live-restore off
ends every container, and says so when the file applies later. A key set
by both docker_daemon_options and a dedicated input, and a bad log value,
stop the run before any change.

Closes #375

Assisted-by: Claude Code:claude-sonnet-5-5
2026-11-25 19:42:06 +00:00

63 lines
3.4 KiB
YAML

---
docker_update: false
docker_remove_data: false
docker_remove: false
docker_packages:
- docker-ce
- docker-ce-cli
- containerd.io
docker_keyring_path: /etc/apt/keyrings/docker.asc
docker_apt_list_path: /etc/apt/sources.list.d/docker.list
docker_gpg_url: https://download.docker.com/linux/ubuntu/gpg
docker_repo_base_url: https://download.docker.com/linux/ubuntu
# Architecture written into the APT source. Empty (the default) derives it from the host: x86_64 gives amd64, aarch64 gives arm64, any
# other architecture fails the play, so set it here (for example armhf) when Docker publishes one for it.
docker_apt_arch: ""
docker_service: docker
docker_group: docker
# Usernames to add to the `docker` group at install time. Left empty by
# default: a role that needs Docker access but installs *after* this one in
# a host's `services:` list won't have created its run-as user yet when this
# role runs, so it must add itself to the group in its own tasks instead.
# This list only helps a role/user that already exists before `docker` runs.
docker_users: []
# Docker manipulates iptables directly for any published container port
# (`-p`), bypassing UFW rules entirely - so the role owns no UFW rule and does
# not call the ufw role.
# With live-restore Docker leaves containers running when dockerd stops, but a reboot of the whole host kills them, and dockerd's restore
# pass at the next boot sometimes skips one without trying. When true, a boot unit starts the containers that Docker left down: only
# those exited with code 255 during this boot whose restart policy is unless-stopped or always, so one stopped on purpose stays stopped.
# Off by default; set it on a host that runs Docker with live-restore.
docker_start_missed: false
# Seconds to wait after Docker answers, so dockerd's own restarts finish first.
docker_start_missed_settle_seconds: 30
# With live-restore dockerd does not stop containers at host shutdown, and systemd-shutdown signals them only after the network is gone. A
# container that holds an NFS mount then blocks in the kernel's final unmount until the SIGKILL timer, and the host takes minutes to stop.
# When true, a shutdown unit sends SIGTERM to every container process while the network and NFS are still up, waits up to
# docker_stop_at_shutdown_timeout seconds, then SIGKILL. It never uses `docker stop`, so the manually-stopped marker is not set.
# Off by default; set it on a host whose containers mount NFS shares.
docker_stop_at_shutdown: false
docker_stop_at_shutdown_timeout: 30
# /etc/docker/daemon.json. The role writes the file only when at least one of these is set, and then owns it whole: a key it does not
# know is removed. Nothing is written by default, so a host that sets none of them keeps its file. The role restarts dockerd only when
# docker_daemon_restart is true (a restart with live-restore off ends every container); otherwise the file applies at the next restart.
# Extra daemon.json keys, merged as they are; a key that a dedicated input below also sets is refused.
docker_daemon_options: {}
# true writes "live-restore": true, so a docker.service restart leaves running containers alone.
docker_live_restore: false
# "log-driver" (for example local) and the "max-size" and "max-file" log options (for example 10m and "3", quoted). Empty writes nothing.
docker_log_driver: ""
docker_log_max_size: ""
docker_log_max_file: ""
# true restarts dockerd when the file changed.
docker_daemon_restart: false