Skip to content

Fix deprecation warning for apt keys#2

Open
alexlanz wants to merge 1 commit intomainfrom
fix-deprecation-warning
Open

Fix deprecation warning for apt keys#2
alexlanz wants to merge 1 commit intomainfrom
fix-deprecation-warning

Conversation

@alexlanz
Copy link
Copy Markdown
Member

@alexlanz alexlanz commented Apr 2, 2026

When updating a server I get this error:

W: https://download.docker.com/linux/ubuntu/dists/noble/InRelease: Key is stored in legacy
trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for
details.

This configuration should fix it.

@alexlanz alexlanz requested review from ThoSap and stplasim April 2, 2026 05:05
Copy link
Copy Markdown

@ThoSap ThoSap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍🏼

One small thing.

Comment on lines 30 to 33
- name: Add Docker Repository
ansible.builtin.apt_repository:
repo: deb https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
repo: deb [arch={{ ansible_architecture | replace('x86_64', 'amd64') | replace('aarch64', 'arm64') }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
state: present
Copy link
Copy Markdown

@ThoSap ThoSap Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a filename so this custom apt repository lands in the subfolder sources.list.d
https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/apt_repository_module.html
You may have to cleanup the old sources list file (manually or with Ansible once).

I suggest docker-ce(.list) (CE stands for Community Edition), same as Docker uses it for other OS:
Image

With this, we have a predictable repo source list name, otherwise it is dependent on the URL.

Suggested change
- name: Add Docker Repository
ansible.builtin.apt_repository:
repo: deb https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
repo: deb [arch={{ ansible_architecture | replace('x86_64', 'amd64') | replace('aarch64', 'arm64') }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
state: present
- name: Add Docker Repository
ansible.builtin.apt_repository:
repo: deb [arch={{ ansible_architecture | replace('x86_64', 'amd64') | replace('aarch64', 'arm64') }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
filename: docker-ce
state: present

Copy link
Copy Markdown

@stplasim stplasim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

- name: Install required system packages
ansible.builtin.apt:
name: '{{ item }}'
state: latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDK if this is a good idea for production. Shouldn't it be present below?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the packages that are in the loop below are not critical.
I think it is fine to update them every time this playbook is executed and keeping for example ca-certificates up-to-date is very important.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I’m fine with leaving it like this. I just wanted to point out that using state: latest can have the side effect of automatically upgrading packages, which might sometimes cause unexpected changes. That said, I agree that keeping things like ca-certificates up-to-date is important, so it’s probably fine for this playbook.

Copy link
Copy Markdown

@ThoSap ThoSap Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On that note, I checked all files of this repo and I think we should add "live-restore": true to the templates/daemon.json.j2.
We always used this at my old workplace, which led to fewer downtimes when we updated docker-ce.
Then systemctl restart docker no longer causes downtimes for bugfix patches.

https://docs.docker.com/engine/daemon/live-restore/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I would move Adjust Docker logging strategy before Update apt and install docker-ce.

Installing docker-ce does not create the file /etc/docker/daemon.json, so this daemon config should already apply on the first install.

Copy link
Copy Markdown

@ThoSap ThoSap Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind about the last comment, you restart the docker daemon in the next step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants