apt-repository adds wrong repo for ppa

258 views
Skip to first unread message

maxgt16

unread,
Sep 22, 2022, 6:45:18 AM9/22/22
to Ansible Project
Hello Community,

I'm working on Ubuntu 22.04 where apt-key is deprecated, with ansible ansible [core 2.13.4]

After adding "ppa:ondrej/php" via "apt_repository" module and then execute "apt update" it throw the following error:
W: http://ppa.launchpad.net/ondrej/php/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

When adding the repo on the server via "add-apt-repository -y ppa:ondrej/php" it adds the correct repo and no error occurs

That's what ansible runs
- name: add php ppa
  apt_repository:
    repo: ppa:ondrej/php
    update_cache: yes

Any ideas? 

Thank you

Dick Visser

unread,
Sep 22, 2022, 7:37:43 AM9/22/22
to ansible...@googlegroups.com
Are you sure it is really not working?
Looks like it's only emitting a deprecation warning

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9cfebdc2-44aa-4c07-b521-60e87b13692dn%40googlegroups.com.
--
Sent from Gmail Mobile

maxgt16

unread,
Sep 29, 2022, 2:50:53 AM9/29/22
to Ansible Project
Yes, you're right, but the deprecation warning is the problem. And this only occurs when the repo is added via Ansible, if it is added via a simple "add-apt-repository" command then this warning does not come.
The real problem is that ansible breaks off with an error message when you "apt update", because this deprecation warning comes up

Rowe, Walter P. (Fed)

unread,
Sep 29, 2022, 7:49:22 AM9/29/22
to ansible...@googlegroups.com
The better place to report this is in the ansible apt module's git repo as an issue so it can be addressed. The apt-key module itself says to refer to the Debian wiki where they recommend managing key files directly in the trusted.gpg.d directory.

https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/apt_key.py

The apt-key command has been deprecated and suggests to 'manage keyring files in trusted.gpg.d instead'. See the Debian wiki for details. This module is kept for backwards compatiblity for systems that still use apt-key as the main way to manage apt repository keys.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

Brian Coca

unread,
Sep 29, 2022, 10:05:42 AM9/29/22
to ansible...@googlegroups.com
We updated apt_repository to prefer the new standards, it still falls
back to the other directories and/or apt-key as needed
https://github.com/ansible/ansible/pull/78735

I'm considering reworking the module and/or just creating a role that
does this properly for all possible environments.

----------
Brian Coca

Reply all
Reply to author
Forward
0 new messages