Files
Kamino/roles/docker/meta/argument_specs.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

167 lines
8.1 KiB
YAML

---
argument_specs:
main:
short_description: Install, update or remove Docker Engine
description:
- >-
Installs Docker Engine from the upstream APT repository, or removes it when C(docker_remove) is true. Optionally updates the packages to
the current candidate versions, then adds C(docker_users) to C(docker_group).
- Needs gathered facts, because the APT source uses C(ansible_distribution_release).
options:
docker_remove:
type: bool
default: false
description:
- >-
Removes Docker instead of installing it. Stops the service, removes the packages, the APT source and the keyring,
and skips the install, update and group tasks.
docker_remove_data:
type: bool
default: false
description:
- >-
Only used with C(docker_remove). Purges the packages and deletes C(/var/lib/docker), which destroys images, containers and volumes.
docker_update:
type: bool
default: false
description:
- >-
Upgrades each package in C(docker_packages) to its current APT candidate version, pinned as package=version.
The C(Restart docker) handler is notified only when a package actually changes.
docker_packages:
type: list
elements: str
default: [docker-ce, docker-ce-cli, containerd.io]
description:
- Packages installed, updated or removed.
docker_keyring_path:
type: path
default: /etc/apt/keyrings/docker.asc
description:
- Where the Docker repository key is stored.
docker_apt_list_path:
type: path
default: /etc/apt/sources.list.d/docker.list
description:
- APT source file written for the Docker repository.
docker_gpg_url:
type: str
default: https://download.docker.com/linux/ubuntu/gpg
description:
- URL of the repository signing key.
docker_repo_base_url:
type: str
default: https://download.docker.com/linux/ubuntu
description:
- Base URL of the repository. The source line uses C(ansible_distribution_release) and the C(stable) component.
docker_apt_arch:
type: str
default: ""
description:
- >-
Architecture written into the APT source. Empty (the default) derives it from the host: C(x86_64) gives C(amd64), C(aarch64)
gives C(arm64). Any other host architecture fails the play, so set this to the name Docker publishes for it. Lowercase letters
and digits only. A value set here is always used.
docker_start_missed:
type: bool
default: false
description:
- >-
Installs C(/usr/local/sbin/docker-start-missed) and the unit C(docker-start-missed.service). After each boot the unit starts the
containers that Docker left down: exited with code 255 during this boot, with restart policy C(unless-stopped) or C(always). A
container stopped on purpose stays stopped. Setting it back to false removes the unit and the script.
- >-
Meant for a host that runs Docker with C(live-restore), where dockerd's restore pass can skip a container after a reboot of the
whole host. The unit does nothing when C(/usr/bin/docker) does not exist.
docker_start_missed_settle_seconds:
type: int
default: 30
description:
- Seconds the unit waits after Docker answers, so dockerd's own restarts finish before it judges what is still down. At least 0.
docker_stop_at_shutdown:
type: bool
default: false
description:
- >-
Installs C(/usr/local/sbin/docker-stop-at-shutdown) and the unit C(docker-stop-at-shutdown.service), started by the role, whose stop
action runs at host shutdown after Docker has stopped and before the network and remote file systems. It sends SIGTERM to every
container process, waits up to C(docker_stop_at_shutdown_timeout) seconds, then SIGKILL. It never uses C(docker stop) or
C(docker kill), which would set the manually-stopped marker. Setting it back to false removes the unit and the script. The role
never stops the running unit, because stopping it runs its stop action and ends every container.
- >-
The unit is ordered before C(docker.service) and after C(network-online.target) and C(remote-fs.target), and that ordering
also applies at boot: Docker then starts only after the network and the remote file systems are up. The script reads the
layout of the systemd cgroup driver on cgroup v2 (C(/sys/fs/cgroup/system.slice/docker-<id>.scope)); on a host that lays
containers out differently it finds nothing, says so in the journal and changes nothing.
- >-
Meant for a host that runs Docker with C(live-restore) and whose containers mount NFS shares: without it a container holding
a mount blocks the shutdown in the kernel's final unmount once the network is gone. The unit does nothing when
C(/usr/bin/docker) does not exist.
docker_stop_at_shutdown_timeout:
type: int
default: 30
description:
- Seconds the unit waits for container processes to end after SIGTERM before it sends SIGKILL. At least 1.
docker_daemon_options:
type: dict
default: {}
description:
- >-
Keys merged as they are into C(/etc/docker/daemon.json), for any setting the dedicated inputs below do not cover. A key that a
dedicated input also sets (C(live-restore), C(log-driver) or C(log-opts)) stops the run. When this or any other daemon input is
set the role owns the whole file: a key it does not know is removed. Nothing is written when every daemon input is at its default.
docker_live_restore:
type: bool
default: false
description:
- >-
true writes C(live-restore) true to C(/etc/docker/daemon.json), so a C(docker.service) restart leaves running containers alone.
It takes effect at the next dockerd restart. Setting it back to false does not remove the key from a file already written.
docker_log_driver:
type: str
default: ""
description:
- >-
Default logging driver written as C(log-driver) (for example C(local) or C(json-file)); lowercase letters, digits and C(-).
Empty writes nothing. The role does not check that the driver accepts the log options below: dockerd refuses to start with one
it rejects.
docker_log_max_size:
type: str
default: ""
description:
- >-
Written as the C(max-size) log option, a whole number with an optional C(k), C(m) or C(g) (for example C(10m)), or C(-1).
Empty writes nothing.
docker_log_max_file:
type: str
default: ""
description:
- >-
Written as the C(max-file) log option, a whole number of at least 1. Quote it, because the input is a string. Empty writes
nothing.
docker_daemon_restart:
type: bool
default: false
description:
- >-
true restarts dockerd when C(/etc/docker/daemon.json) changed. false (the default) leaves the running daemon alone, because a
restart with C(live-restore) off ends every container; the file then applies at the next restart and the role says so.
docker_service:
type: str
default: docker
description:
- Name of the systemd unit that is enabled, started, restarted and stopped.
docker_group:
type: str
default: docker
description:
- Group that C(docker_users) are added to.
docker_users:
type: list
elements: str
default: []
description:
- >-
Existing users added to C(docker_group) with append. Empty by default, because a role that installs after docker creates its
run-as user too late and must join the group itself.