The docker role installs, updates and removes Docker but leaves /etc/docker/daemon.json alone, so a consumer keeps a second role or a hand-edited file for the daemon's own settings. Two settings are the usual reason:
live-restore: true, so that a docker.service restart (for example from an unattended-upgrades bump of docker-ce or containerd.io) does not kill running containers. The opt-in boot and shutdown units in this role only make sense on a host that has it.
The default log settings: json-file has no size cap and grows without bound, while the local driver is compact and still readable with docker logs.
Out of scope: per-container logging options, registry mirrors and TLS settings (they can go through the extra-options dict below), and restarting dockerd.
Proposal
New inputs, defaults that leave an existing host unchanged:
docker_daemon_options (dict, default {}): merged into the file as-is, for any key not covered below.
docker_log_driver, docker_log_max_size, docker_log_max_file (strings, default empty): when set, written as log-driver and log-opts; when empty, nothing is written for them.
docker_live_restore (bool, default false): when true, writes "live-restore": true.
The role writes the file only when at least one input is set (valid JSON, mode 0644, validated before it replaces the old file). It never restarts dockerd on its own: a restart with live-restore off kills every container. A change is applied at the next daemon restart; the role says so in a task message, and a new input docker_daemon_restart (bool, default false) notifies a restart handler for a host where that is acceptable.
Open question for the maintainer: whether live-restore should be applied with a reload (SIGHUP, which dockerd supports for that key) instead, so enabling it needs no restart.
Acceptance criteria
With every new input at its default, no file is created or changed. Check: Molecule idempotence and a stat assertion.
Setting the inputs writes a valid JSON file with the stated keys; a second run reports no change. Check: Molecule verify parses the file with from_json and compares the keys.
A key in docker_daemon_options that collides with a dedicated input is refused before the file is written. Check: a Molecule converge play that expects the failure.
dockerd is not restarted unless docker_daemon_restart is true. Check: verify that the handler did not run (service start time unchanged) in the default scenario.
argument_specs.yml, the README and a changelog fragment (minor_changes) cover the inputs. Check: ansible-doc, antsibull-changelog lint.
Assisted-by: Claude Code
## Problem
The `docker` role installs, updates and removes Docker but leaves `/etc/docker/daemon.json` alone, so a consumer keeps a second role or a hand-edited file for the daemon's own settings. Two settings are the usual reason:
- `live-restore: true`, so that a `docker.service` restart (for example from an unattended-upgrades bump of docker-ce or containerd.io) does not kill running containers. The opt-in boot and shutdown units in this role only make sense on a host that has it.
- The default log settings: `json-file` has no size cap and grows without bound, while the `local` driver is compact and still readable with `docker logs`.
Out of scope: per-container logging options, registry mirrors and TLS settings (they can go through the extra-options dict below), and restarting dockerd.
## Proposal
New inputs, defaults that leave an existing host unchanged:
- `docker_daemon_options` (dict, default `{}`): merged into the file as-is, for any key not covered below.
- `docker_log_driver`, `docker_log_max_size`, `docker_log_max_file` (strings, default empty): when set, written as `log-driver` and `log-opts`; when empty, nothing is written for them.
- `docker_live_restore` (bool, default `false`): when true, writes `"live-restore": true`.
The role writes the file only when at least one input is set (valid JSON, mode 0644, validated before it replaces the old file). It never restarts dockerd on its own: a restart with live-restore off kills every container. A change is applied at the next daemon restart; the role says so in a task message, and a new input `docker_daemon_restart` (bool, default `false`) notifies a restart handler for a host where that is acceptable.
Open question for the maintainer: whether `live-restore` should be applied with a reload (SIGHUP, which dockerd supports for that key) instead, so enabling it needs no restart.
## Acceptance criteria
- [ ] With every new input at its default, no file is created or changed. Check: Molecule idempotence and a `stat` assertion.
- [ ] Setting the inputs writes a valid JSON file with the stated keys; a second run reports no change. Check: Molecule verify parses the file with `from_json` and compares the keys.
- [ ] A key in `docker_daemon_options` that collides with a dedicated input is refused before the file is written. Check: a Molecule converge play that expects the failure.
- [ ] dockerd is not restarted unless `docker_daemon_restart` is true. Check: verify that the handler did not run (service start time unchanged) in the default scenario.
- [ ] `argument_specs.yml`, the README and a changelog fragment (`minor_changes`) cover the inputs. Check: `ansible-doc`, `antsibull-changelog lint`.
Assisted-by: Claude Code
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
The
dockerrole installs, updates and removes Docker but leaves/etc/docker/daemon.jsonalone, so a consumer keeps a second role or a hand-edited file for the daemon's own settings. Two settings are the usual reason:live-restore: true, so that adocker.servicerestart (for example from an unattended-upgrades bump of docker-ce or containerd.io) does not kill running containers. The opt-in boot and shutdown units in this role only make sense on a host that has it.json-filehas no size cap and grows without bound, while thelocaldriver is compact and still readable withdocker logs.Out of scope: per-container logging options, registry mirrors and TLS settings (they can go through the extra-options dict below), and restarting dockerd.
Proposal
New inputs, defaults that leave an existing host unchanged:
docker_daemon_options(dict, default{}): merged into the file as-is, for any key not covered below.docker_log_driver,docker_log_max_size,docker_log_max_file(strings, default empty): when set, written aslog-driverandlog-opts; when empty, nothing is written for them.docker_live_restore(bool, defaultfalse): when true, writes"live-restore": true.The role writes the file only when at least one input is set (valid JSON, mode 0644, validated before it replaces the old file). It never restarts dockerd on its own: a restart with live-restore off kills every container. A change is applied at the next daemon restart; the role says so in a task message, and a new input
docker_daemon_restart(bool, defaultfalse) notifies a restart handler for a host where that is acceptable.Open question for the maintainer: whether
live-restoreshould be applied with a reload (SIGHUP, which dockerd supports for that key) instead, so enabling it needs no restart.Acceptance criteria
statassertion.from_jsonand compares the keys.docker_daemon_optionsthat collides with a dedicated input is refused before the file is written. Check: a Molecule converge play that expects the failure.docker_daemon_restartis true. Check: verify that the handler did not run (service start time unchanged) in the default scenario.argument_specs.yml, the README and a changelog fragment (minor_changes) cover the inputs. Check:ansible-doc,antsibull-changelog lint.Assisted-by: Claude Code