JonasPammer / ansible-role-goaccess

An ansible role for installing GoAccess, a real-time web log analyzer that runs in a terminal or the browser.
MIT License
4 stars 1 forks source link

[Bug]: Failed to update apt cache: W:GPG error debian12 / bookworm #65

Open mabed-fr opened 2 months ago

mabed-fr commented 2 months ago

What happened?

Hello

Thank you for this magnificent role.

I just tried to deploy this one on my Debian 12 machines (Bookworm) with this variables

goaccess_install_method: system
goaccess_systemd: true

And I encounter the following error:

FAILED! => {"changed": false, "msg": "Failed to update apt cache: W:GPG error: https://deb.goaccess.io bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 97BD1A0133449C3D, E:The repository 'https://deb.goaccess.io bookworm InRelease' is not signed."}

To the job: TASK [ansible-role-goaccess: Add GoAccess's APT repository to system repository list and update cache.] On my 3 Debian 12.

However, manual installation gives the same thing but the documentation (https://goaccess.io/download#distro) gives the solution in bash.

The following signatures were invalid: EXPKEYSIG 97BD1A0133449C3D.... See [Github issue](https://github.com/allinurl/goaccess/issues/2321#issuecomment-1128879773) to solve the expired key.
GPG error The following signatures couldn't be verified because the public key is not available.
Please make sure to download the new public key from step 2 above to correct this.
.deb packages in the official repo are available through https as well. You may need to install apt-transport-https.
The key fingerprint is: C03B 4888 7D5E 56B0 4671 5D32 97BD 1A01 3344 9C3D

If I understand: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (It's not the problem but it soon will be)

The real problem and the goacess documentation...

apt-key list | grep goaccess -C 2
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
pub   rsa3072 2020-05-17 [SC]
      C03B 4888 7D5E 56B0 4671  5D32 97BD 1A01 3344 9C3D
uid           [ unknown] Gerardo Orellana <goaccess@prosoftcorp.com>
sub   rsa3072 2020-05-17 [E]

I suggest if you want to change that:

- name: Add GoAccess's APT signing key.
  ansible.builtin.apt_key:
    url: "https://deb.goaccess.io/gnugpg.key"
    state: present

- name: Add GoAccess's APT repository to system repository list and update cache.
  ansible.builtin.apt_repository:
    repo: "deb [signed-by=/usr/share/keyrings/goaccess.gpg] https://deb.goaccess.io/ {{ ansible_distribution_release }} main"
    filename: goaccess
    state: present
    update_cache: true

to this:


tasks file of ansible-role jonaspammer.goaccess

And add the default vars

→ grep "goaccess_repo_key_url" /roles/ansible-role-goaccess/defaults/main.yml
goaccess_repo_key_url: "https://deb.goaccess.io/gnugpg.key"

Test OK

Available to talk about it

Playbook

site.yml
- hosts:
    - all
  roles:
    - ansible-role-goaccess
  tags: goaccess

requirements.yml
- src: git@github.com:JonasPammer/ansible-role-goaccess.git
  scm: git
  version: 2.0.0+1

Role Version

2.0.0+1

Environment / Control Node Information

cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

ansible --version
ansible [core 2.16.6]
  config file = None
  configured module search path = ['/home/mabed/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/mabed/.local/share/virtualenvs/ansible-hcBhBNDq/lib/python3.11/site-packages/ansible
  ansible collection location = /home/mabed/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/mabed/.local/share/virtualenvs/ansible-hcBhBNDq/bin/ansible
  python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] (/home/mabed/.local/share/virtualenvs/ansible-hcBhBNDq/bin/python)
  jinja version = 3.1.3
  libyaml = True

Environment / Managed Node Information

06:41:52 root@SRV-MABED ~ → cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"