Before the docker role writes its apt source, check that Docker publishes the suite it is about to point at, and let an operator hold a host on an earlier release. No change to the file format.
Why
install.yml writes docker.list on every run with the current OS release (ansible_distribution_release). After an OS upgrade, the next run points apt at a suite that Docker has not published yet (Docker lags the Debian and Ubuntu releases), and apt update then fails for every package on the host, not only Docker's. A check that the suite exists, and a way to stay on the previous release until it does, prevents that.
(An earlier version of this issue claimed that docker.list keeps a stale suite. That was wrong: the file is rewritten every run and follows the OS. See the comment below.)
Proposed change
Send a HEAD request to <docker_repo_base_url>/dists/<suite>/Release before writing the source (status 200 or 404, a few retries, check_mode: false). Skip the check when the base URL is not http(s), so a local mirror still works.
On 404 with an existing Docker source: keep it and print a note that names the override. On 404 with no source: fail with a message that names the override.
New variable docker_apt_suite (string, default empty, meaning the OS release) to hold a host on an earlier release.
argument_specs, README, a changelog fragment, and Molecule cases for the 404 paths using a local HTTP server.
Not in this issue
The deb822 migration and a key refresh. Both are separate topics and, if they come back, they come back as their own opt-in issues.
Questions for the maintainer
Is docker_apt_suite the right name?
Should the check be on by default? I think yes: it can only prevent a broken apt update.
With no existing source and a 404, is failing the behaviour you want?
## What
Before the `docker` role writes its apt source, check that Docker publishes the suite it is about to point at, and let an operator hold a host on an earlier release. No change to the file format.
## Why
`install.yml` writes `docker.list` on every run with the current OS release (`ansible_distribution_release`). After an OS upgrade, the next run points apt at a suite that Docker has not published yet (Docker lags the Debian and Ubuntu releases), and `apt update` then fails for every package on the host, not only Docker's. A check that the suite exists, and a way to stay on the previous release until it does, prevents that.
(An earlier version of this issue claimed that `docker.list` keeps a stale suite. That was wrong: the file is rewritten every run and follows the OS. See the comment below.)
## Proposed change
- Send a `HEAD` request to `<docker_repo_base_url>/dists/<suite>/Release` before writing the source (status 200 or 404, a few retries, `check_mode: false`). Skip the check when the base URL is not http(s), so a local mirror still works.
- On 404 with an existing Docker source: keep it and print a note that names the override. On 404 with no source: fail with a message that names the override.
- New variable `docker_apt_suite` (string, default empty, meaning the OS release) to hold a host on an earlier release.
- `argument_specs`, README, a changelog fragment, and Molecule cases for the 404 paths using a local HTTP server.
## Not in this issue
The deb822 migration and a key refresh. Both are separate topics and, if they come back, they come back as their own opt-in issues.
## Questions for the maintainer
- Is `docker_apt_suite` the right name?
- Should the check be on by default? I think yes: it can only prevent a broken `apt update`.
- With no existing source and a 404, is failing the behaviour you want?
Triage notes on this proposal. Part of it is good, part of the premise doesn't match the code.
"Stale suites" is not what the role does today.roles/docker/tasks/install.yml writes docker.list with copy and content: using {{ ansible_distribution_release }}, so every run rewrites it to the current OS release. The file follows the OS; it does not keep an old suite. The real failure is your second bullet, the opposite one: after an OS upgrade, a re-run points apt at a suite Docker hasn't published yet, and apt update breaks for every package. Please correct the description.
Key refresh is true.get_url skips when the destination exists, so docker.asc is never refreshed.
What is worth doing
The suite-published check (dists/<suite>/Release), plus a prefixed override variable to hold a host on an earlier release. It fixes the real failure and changes no file format.
Key refresh, if there is a safe way to do it.
What I'm not convinced of. deb822 itself is cosmetic: signed-by= in the one-line form is already valid. If the format change drives the migration (backup, write, verify docker-ce, roll back), most of the risk is self-inflicted, and the rollback path is hard to cover in Molecule. If it goes ahead, make it opt-in first. It must not be the default, because it rewrites a file on every consumer host.
Suggested split: one issue/PR for the suite check and override, a separate one for the optional deb822 migration. Please say whether you agree.
Status: Priority/Medium, Kind/Enhancement. Not Ready for Agent until the split is settled.
Triage notes on this proposal. Part of it is good, part of the premise doesn't match the code.
**"Stale suites" is not what the role does today.** `roles/docker/tasks/install.yml` writes `docker.list` with `copy` and `content:` using `{{ ansible_distribution_release }}`, so every run rewrites it to the current OS release. The file follows the OS; it does not keep an old suite. The real failure is your second bullet, the opposite one: after an OS upgrade, a re-run points apt at a suite Docker hasn't published yet, and `apt update` breaks for every package. Please correct the description.
**Key refresh is true.** `get_url` skips when the destination exists, so `docker.asc` is never refreshed.
**What is worth doing**
1. The suite-published check (`dists/<suite>/Release`), plus a prefixed override variable to hold a host on an earlier release. It fixes the real failure and changes no file format.
2. Key refresh, if there is a safe way to do it.
**What I'm not convinced of.** deb822 itself is cosmetic: `signed-by=` in the one-line form is already valid. If the format change drives the migration (backup, write, verify `docker-ce`, roll back), most of the risk is self-inflicted, and the rollback path is hard to cover in Molecule. If it goes ahead, make it opt-in first. It must not be the default, because it rewrites a file on every consumer host.
**Suggested split:** one issue/PR for the suite check and override, a separate one for the optional deb822 migration. Please say whether you agree.
Status: Priority/Medium, Kind/Enhancement. Not `Ready for Agent` until the split is settled.
Thanks, you are right, and I want to be clear about what was wrong.
The premise. I wrote that docker.list keeps a stale suite. In this role it does not: install.yml writes it with copy and content: using {{ ansible_distribution_release }}, so every run rewrites it to the current OS release. I described the behaviour of hosts I set up by hand, not of this role. The failure that does exist is the opposite one, as you say: after an OS upgrade, the next run points apt at a suite Docker has not published yet, and apt update breaks for every package. Key refresh is also as you say: get_url skips when docker.asc exists.
Agreed split.
This issue becomes the suite check and the override, with no change to the file format. The body is rewritten accordingly and the deb822 migration is removed from it.
deb822 migration: out of this issue. If it ever comes back, it comes back as its own opt-in issue, never as a default. I will not file it unless you ask.
Key refresh: also separate, and I will not bundle it here (fetching a key from the network on every converge is a trust decision that deserves its own discussion).
What the PR would do (no code until you mark this Ready for Agent):
Before writing docker.list, send a HEAD request to <docker_repo_base_url>/dists/<suite>/Release (200 or 404, a few retries, check_mode: false; skipped when the base URL is not http(s), so a local mirror works).
On 404 with an existing Docker source: keep it, print a note naming the override. On 404 with no source: fail with a message that names the override.
docker_apt_suite (string, default empty = the OS release) holds a host on an earlier release.
argument_specs, README, a changelog fragment, and Molecule cases for the 404 paths using a local HTTP server.
Questions for you: is docker_apt_suite the right name; should the check be on by default (I think yes, it only ever prevents a broken apt update); and is failing, when there is no existing source, the behaviour you want?
I am marking this ready for your input.
Assisted-by: Claude Code
Thanks, you are right, and I want to be clear about what was wrong.
**The premise.** I wrote that `docker.list` keeps a stale suite. In this role it does not: `install.yml` writes it with `copy` and `content:` using `{{ ansible_distribution_release }}`, so every run rewrites it to the current OS release. I described the behaviour of hosts I set up by hand, not of this role. The failure that does exist is the opposite one, as you say: after an OS upgrade, the next run points apt at a suite Docker has not published yet, and `apt update` breaks for every package. Key refresh is also as you say: `get_url` skips when `docker.asc` exists.
**Agreed split.**
1. **This issue becomes the suite check and the override**, with no change to the file format. The body is rewritten accordingly and the deb822 migration is removed from it.
2. **deb822 migration:** out of this issue. If it ever comes back, it comes back as its own opt-in issue, never as a default. I will not file it unless you ask.
3. **Key refresh:** also separate, and I will not bundle it here (fetching a key from the network on every converge is a trust decision that deserves its own discussion).
**What the PR would do** (no code until you mark this `Ready for Agent`):
- Before writing `docker.list`, send a `HEAD` request to `<docker_repo_base_url>/dists/<suite>/Release` (200 or 404, a few retries, `check_mode: false`; skipped when the base URL is not http(s), so a local mirror works).
- On 404 with an existing Docker source: keep it, print a note naming the override. On 404 with no source: fail with a message that names the override.
- `docker_apt_suite` (string, default empty = the OS release) holds a host on an earlier release.
- `argument_specs`, README, a changelog fragment, and Molecule cases for the 404 paths using a local HTTP server.
**Questions for you:** is `docker_apt_suite` the right name; should the check be on by default (I think yes, it only ever prevents a broken `apt update`); and is failing, when there is no existing source, the behaviour you want?
I am marking this ready for your input.
Assisted-by: Claude Code
Dragonish
changed title from feat(docker): deb822 apt source with a suite check and a safe migration (proposal) to feat(docker): check that Docker publishes the suite before writing the apt source2026-11-15 14:14:24 +00:00
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
Before the
dockerrole writes its apt source, check that Docker publishes the suite it is about to point at, and let an operator hold a host on an earlier release. No change to the file format.Why
install.ymlwritesdocker.liston every run with the current OS release (ansible_distribution_release). After an OS upgrade, the next run points apt at a suite that Docker has not published yet (Docker lags the Debian and Ubuntu releases), andapt updatethen fails for every package on the host, not only Docker's. A check that the suite exists, and a way to stay on the previous release until it does, prevents that.(An earlier version of this issue claimed that
docker.listkeeps a stale suite. That was wrong: the file is rewritten every run and follows the OS. See the comment below.)Proposed change
HEADrequest to<docker_repo_base_url>/dists/<suite>/Releasebefore writing the source (status 200 or 404, a few retries,check_mode: false). Skip the check when the base URL is not http(s), so a local mirror still works.docker_apt_suite(string, default empty, meaning the OS release) to hold a host on an earlier release.argument_specs, README, a changelog fragment, and Molecule cases for the 404 paths using a local HTTP server.Not in this issue
The deb822 migration and a key refresh. Both are separate topics and, if they come back, they come back as their own opt-in issues.
Questions for the maintainer
docker_apt_suitethe right name?apt update.Triage notes on this proposal. Part of it is good, part of the premise doesn't match the code.
"Stale suites" is not what the role does today.
roles/docker/tasks/install.ymlwritesdocker.listwithcopyandcontent:using{{ ansible_distribution_release }}, so every run rewrites it to the current OS release. The file follows the OS; it does not keep an old suite. The real failure is your second bullet, the opposite one: after an OS upgrade, a re-run points apt at a suite Docker hasn't published yet, andapt updatebreaks for every package. Please correct the description.Key refresh is true.
get_urlskips when the destination exists, sodocker.ascis never refreshed.What is worth doing
dists/<suite>/Release), plus a prefixed override variable to hold a host on an earlier release. It fixes the real failure and changes no file format.What I'm not convinced of. deb822 itself is cosmetic:
signed-by=in the one-line form is already valid. If the format change drives the migration (backup, write, verifydocker-ce, roll back), most of the risk is self-inflicted, and the rollback path is hard to cover in Molecule. If it goes ahead, make it opt-in first. It must not be the default, because it rewrites a file on every consumer host.Suggested split: one issue/PR for the suite check and override, a separate one for the optional deb822 migration. Please say whether you agree.
Status: Priority/Medium, Kind/Enhancement. Not
Ready for Agentuntil the split is settled.Thanks, you are right, and I want to be clear about what was wrong.
The premise. I wrote that
docker.listkeeps a stale suite. In this role it does not:install.ymlwrites it withcopyandcontent:using{{ ansible_distribution_release }}, so every run rewrites it to the current OS release. I described the behaviour of hosts I set up by hand, not of this role. The failure that does exist is the opposite one, as you say: after an OS upgrade, the next run points apt at a suite Docker has not published yet, andapt updatebreaks for every package. Key refresh is also as you say:get_urlskips whendocker.ascexists.Agreed split.
What the PR would do (no code until you mark this
Ready for Agent):docker.list, send aHEADrequest to<docker_repo_base_url>/dists/<suite>/Release(200 or 404, a few retries,check_mode: false; skipped when the base URL is not http(s), so a local mirror works).docker_apt_suite(string, default empty = the OS release) holds a host on an earlier release.argument_specs, README, a changelog fragment, and Molecule cases for the 404 paths using a local HTTP server.Questions for you: is
docker_apt_suitethe right name; should the check be on by default (I think yes, it only ever prevents a brokenapt update); and is failing, when there is no existing source, the behaviour you want?I am marking this ready for your input.
Assisted-by: Claude Code
feat(docker): deb822 apt source with a suite check and a safe migration (proposal)to feat(docker): check that Docker publishes the suite before writing the apt source