I keep getting this error when running my playbook on Ubuntu 22.04LTS server and have been trying to fix it for sometime now but aren't making progress.

fatal: [MY IP]: FAILED! => {"changed": false, "msg": "Failed to update apt cache: W:Updating from such a repository can't be done securely, and is therefore disabled by default., W:See apt-secure(8) manpage for repository creation and user configuration details., W:GPG error: https://pkg.jenkins.io/debian-stable binary/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5BA**********5CA, E:The repository 'https://pkg.jenkins.io/debian-stable binary/ Release' is not signed."}

  • How did you import the public gpg key for the repository? May 24 at 12:46
  • And what does your sources.list for jenkins look like? May 24 at 12:49
  • I used the commands: curl -fsSL pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee \ /usr/share/keyrings/jenkins-keyring.asc > /dev/null echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \ pkg.jenkins.io/debian-stable binary/ | sudo tee \ /etc/apt/sources.list.d/jenkins.list > /dev/null
    – Haha Hehe
    May 24 at 12:56
  • Please edit addition information in the question, it's unreadable in the comments. May 24 at 13:05
  • And please show what your configuration files look like, don't just copy the commands from the documentation. May 24 at 13:09

1 Answer 1


The PGP key you downloaded is wrong.

The current installation instructions contain this command for the import:

curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
  /usr/share/keyrings/jenkins-keyring.asc > /dev/null

You used an older URL which is missing the -2023 in the key filename.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .