On Linux Mint 21 I am trying to install signed packages from external repos. I have the same problem with 5 different repos.
I can get the PGP key and add the repo to the /etc/apt/sources.list.d/ directory, but when I call apt, it makes another entry in the sources directory (but without the pointer to the key). This causes the install to fail.
If I remove the second entry, then the package installs correctly. I have tried several of the parameters to apt, but without success.
Here is an example, to install Chrome:
- name: Add Chrome signing key
get_url:
url: https://dl.google.com/linux/linux_signing_key.pub
dest: /usr/share/keyrings/google-chrome.asc
mode: '0644'
force: true
- name: Add Chrome repository
apt_repository:
repo: deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.asc] https://dl.google.com/linux/chrome/deb/ stable main
state: present
At this point I correctly have:
/etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list
which correctly contains:
deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.asc] https://dl.google.com/linux/chrome/deb/ stable main
After calling
- name: Add Chrome package
apt:
name: "google-chrome-stable"
there is a second list in the sources directory:
/etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list
/etc/apt/sources.list.d/google-chrome.list
This second list points to the repo, but without the key:
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main
Like I say, if I remove the second entry, then the package installs correctly.
Question: How do I stop this incorrect list from being added?
Further testing: I used Ansible to get the key and add the repo to /etc/apt/sources.list.d/ and then I manually called
sudo apt install google-chrome-stable
It correctly installed but then also added the google-chrome.list file.
The same thing happens when I try to install Docker, TeamViewer, VS Code, and 1Password so it isn't just Chrome.
So how do I use Ansible to install signed external packages?