The docker role did not manage /etc/docker/daemon.json, so a consumer kept a second role or a hand-edited file for the daemon's own settings (live-restore, the log driver and its limits).
New inputs, all with defaults that leave an existing host unchanged:
docker_daemon_options (dict): extra keys, merged as they are.
docker_log_driver, docker_log_max_size, docker_log_max_file (strings): written as log-driver and the max-size and max-file log options.
docker_daemon_restart (bool, default false): restarts dockerd when the file changed.
The file is written, before the packages are installed so that a first start of dockerd already reads it, only when one of the first five inputs is set. The role then owns the whole file: a key it does not know is removed. It never restarts dockerd unless docker_daemon_restart is true, because a restart with live-restore off ends every container; otherwise it says the file applies at the next restart. A key set both in docker_daemon_options and by a dedicated input, and a bad driver, size or file count, stop the run before any change.
Differences from the issue
The issue left open whether live-restore should be applied with a reload instead of a restart. I followed the proposal as written (restart only on request) and did not implement a reload; it can be a later change.
Removal: docker_remove leaves the file in place, as it does for a file the role cannot tell from the consumer's own. The README says so.
Verified
Every pre-commit hook passes, including yamllint, ansible-lint and the changelog fragment lint.
Through Ansible on localhost, with the real tasks/validate.yml and a copy of tasks/daemon.yml pointed at a temporary directory (owner and become removed in the copy): the 7 bad settings are each refused with a message that names an input; good values pass; nothing is written with the defaults; the file holds exactly the expected keys; a second run reports no change; the restart handler does not run with docker_daemon_restart: false and does with true; a second change replaces the whole file.
Not verified
The Molecule scenario has not run on this change. Its first CI run may fail, in particular the new check that reads the start time of the stand-in docker.service before and after a change.
A real dockerd starting with the written file. The stand-in service is sleep infinity, so CI shows the file and the restart logic, not that dockerd accepts the settings.
A log driver rejecting its options (the local driver refuses some combinations): the role checks the shape of the inputs, not that the driver accepts them. The README warns about it.
I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.
Assisted-by: Claude Code:claude-sonnet-5-5
## What and why
Closes #375.
The `docker` role did not manage `/etc/docker/daemon.json`, so a consumer kept a second role or a hand-edited file for the daemon's own settings (`live-restore`, the log driver and its limits).
New inputs, all with defaults that leave an existing host unchanged:
- `docker_daemon_options` (dict): extra keys, merged as they are.
- `docker_live_restore` (bool): writes `"live-restore": true`.
- `docker_log_driver`, `docker_log_max_size`, `docker_log_max_file` (strings): written as `log-driver` and the `max-size` and `max-file` log options.
- `docker_daemon_restart` (bool, default `false`): restarts dockerd when the file changed.
The file is written, before the packages are installed so that a first start of dockerd already reads it, only when one of the first five inputs is set. The role then owns the whole file: a key it does not know is removed. It never restarts dockerd unless `docker_daemon_restart` is true, because a restart with `live-restore` off ends every container; otherwise it says the file applies at the next restart. A key set both in `docker_daemon_options` and by a dedicated input, and a bad driver, size or file count, stop the run before any change.
## Differences from the issue
- The issue left open whether `live-restore` should be applied with a reload instead of a restart. I followed the proposal as written (restart only on request) and did not implement a reload; it can be a later change.
- Removal: `docker_remove` leaves the file in place, as it does for a file the role cannot tell from the consumer's own. The README says so.
## Verified
- Every pre-commit hook passes, including `yamllint`, `ansible-lint` and the changelog fragment lint.
- Through Ansible on localhost, with the real `tasks/validate.yml` and a copy of `tasks/daemon.yml` pointed at a temporary directory (owner and `become` removed in the copy): the 7 bad settings are each refused with a message that names an input; good values pass; nothing is written with the defaults; the file holds exactly the expected keys; a second run reports no change; the restart handler does not run with `docker_daemon_restart: false` and does with `true`; a second change replaces the whole file.
## Not verified
- The Molecule scenario has not run on this change. Its first CI run may fail, in particular the new check that reads the start time of the stand-in `docker.service` before and after a change.
- A real dockerd starting with the written file. The stand-in service is `sleep infinity`, so CI shows the file and the restart logic, not that dockerd accepts the settings.
- A log driver rejecting its options (the `local` driver refuses some combinations): the role checks the shape of the inputs, not that the driver accepts them. The README warns about it.
---
- [ ] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none.
Assisted-by: Claude Code:claude-sonnet-5-5
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
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.
What and why
Closes #375.
The
dockerrole did not manage/etc/docker/daemon.json, so a consumer kept a second role or a hand-edited file for the daemon's own settings (live-restore, the log driver and its limits).New inputs, all with defaults that leave an existing host unchanged:
docker_daemon_options(dict): extra keys, merged as they are.docker_live_restore(bool): writes"live-restore": true.docker_log_driver,docker_log_max_size,docker_log_max_file(strings): written aslog-driverand themax-sizeandmax-filelog options.docker_daemon_restart(bool, defaultfalse): restarts dockerd when the file changed.The file is written, before the packages are installed so that a first start of dockerd already reads it, only when one of the first five inputs is set. The role then owns the whole file: a key it does not know is removed. It never restarts dockerd unless
docker_daemon_restartis true, because a restart withlive-restoreoff ends every container; otherwise it says the file applies at the next restart. A key set both indocker_daemon_optionsand by a dedicated input, and a bad driver, size or file count, stop the run before any change.Differences from the issue
live-restoreshould be applied with a reload instead of a restart. I followed the proposal as written (restart only on request) and did not implement a reload; it can be a later change.docker_removeleaves the file in place, as it does for a file the role cannot tell from the consumer's own. The README says so.Verified
yamllint,ansible-lintand the changelog fragment lint.tasks/validate.ymland a copy oftasks/daemon.ymlpointed at a temporary directory (owner andbecomeremoved in the copy): the 7 bad settings are each refused with a message that names an input; good values pass; nothing is written with the defaults; the file holds exactly the expected keys; a second run reports no change; the restart handler does not run withdocker_daemon_restart: falseand does withtrue; a second change replaces the whole file.Not verified
docker.servicebefore and after a change.sleep infinity, so CI shows the file and the restart logic, not that dockerd accepts the settings.localdriver refuses some combinations): the role checks the shape of the inputs, not that the driver accepts them. The README warns about it.NOTICEandREUSE.toml, or there is none.Assisted-by: Claude Code:claude-sonnet-5-5