Ansible模块无法用于添加git-ppa-“ W:GPG错误-NO_PUBKEY”错误

时间:2019-01-21 04:07:03

标签: ubuntu ansible apt

几个月前,我完成以下任务的剧本运行成功。

- name: add git ppa repo
  apt_repository:
    repo: deb-src http://ppa.launchpad.net/git-core/ppa/ubuntu {{ ansible_lsb.codename }} main
    state:  present
  become: yes

- name: Add git apt key by id from a keyserver
  apt_key:
    keyserver: keyserver.ubuntu.com
    id: A1715D88E1DF1F24
    state: present
  become: yes

当我现在运行它时,它因错误而中断

  

W:GPG错误:http://ppa.launchpad.net/git-core/ppa/ubuntu仿生发行:由于公共密钥不可用,因此无法验证以下签名:NO_PUBKEY A1715D88E1DF1F24   E:存储库“ http://ppa.launchpad.net/git-core/ppa/ubuntu仿生发行”未签名。

我可以通过运行
来修复错误 sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com A1715D88E1DF1F24

如果我不想将其作为RAW / SHELL ansible命令运行。还有其他方法可以解决此问题,我想知道ansible apt_key节出了什么问题,我相信以前做过同样的事情并且正在工作。谢谢!

1 个答案:

答案 0 :(得分:0)

我在Win Bash中使用Ubuntu 18.04存在类似问题,该解决方案对我有用:

Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
Hit:6 http://ppa.launchpad.net/webupd8team/java/ubuntu bionic InRelease
Err:5 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4F4EA0AAE5267A6C
Err:6 http://ppa.launchpad.net/webupd8team/java/ubuntu bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C2518248EEA14886
Hit:7 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu bionic InRelease
Err:3 http://security.ubuntu.com/ubuntu bionic-security InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
Get:1 http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic InRelease [15.9 kB]
Err:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
Err:7 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C2518248EEA14886
Err:1 http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EA8CACC073C3DB2A
  1. 我尝试使用apt-get update e收到错误:由于公钥不可用,无法验证:NO_PUBKEY 3B4FE6ACC0B21F32

  2. 因此,我使用curl -sL“ http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xREPLACENUMBERPUBKEY” | sudo apt-key add用0x替换0x3B4FE6ACC0B21F32

  3. 示例:curl -sL“ http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3B4FE6ACC0B21F32” | sudo apt-key添加

引荐人:https://github.com/Microsoft/WSL/issues/3286#issuecomment-402594992