从ansible失败为mongodb repo添加apt-key,从shell成功

时间:2019-03-13 17:59:50

标签: ansible apt-key

成功:

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
Executing: /tmp/apt-key-gpghome.TgkaWkin7p/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
gpg: key 68818C72E52529D4: public key "MongoDB 4.0 Release Signing Key <packaging@mongodb.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1

但这失败了:

  - name: install_mongodb.yml --> Add apt-key for mongodb repository
    apt_key:
      id: 9DA31620334BD75D9DCB49F368818C72E52529D4
      keyserver: keyserver.ubuntu.com

出现此错误:

fatal: [mongodb_primary_1]: FAILED! => changed=false 
  cmd: /usr/bin/apt-key adv --no-tty --keyserver keyserver.ubuntu.com --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
  msg: 'Error fetching key 9DA31620334BD75D9DCB49F368818C72E52529D4 from keyserver: keyserver.ubuntu.com'
  rc: 2
  stderr: |-
    gpg: requesting key E52529D4 from hkp server keyserver.ubuntu.com
    gpg: no valid OpenPGP data found.
    gpg: Total number processed: 0
    gpg: keyserver communications error: keyserver helper general error
    gpg: keyserver communications error: unknown pubkey algorithm
    gpg: keyserver receive failed: unknown pubkey algorithm
  stderr_lines:
  - 'gpg: requesting key E52529D4 from hkp server keyserver.ubuntu.com'
  - 'gpg: no valid OpenPGP data found.'
  - 'gpg: Total number processed: 0'
  - 'gpg: keyserver communications error: keyserver helper general error'
  - 'gpg: keyserver communications error: unknown pubkey algorithm'
  - 'gpg: keyserver receive failed: unknown pubkey algorithm'
  stdout: |-
    Executing: /tmp/tmp.e0jptD7eDI/gpg.1.sh --no-tty
    --keyserver
    keyserver.ubuntu.com
    --recv
    9DA31620334BD75D9DCB49F368818C72E52529D4
    gpgkeys: key 9DA31620334BD75D9DCB49F368818C72E52529D4 can't be retrieved
  stdout_lines: <omitted>

这可以在vagrant预配器的ansible机器中运行 很重要;

有什么主意吗?

0 个答案:

没有答案