首页 文章

在VM中安装java时出错 . (Vagrant&Ansible)

提问于
浏览
0

我正在尝试使用ansible在一个流浪汉虚拟机中安装java我如何键入“ansible-playbook”命令输出返回此错误:

失败了! => {“已更改”:false,“cmd”:“apt-key add - ”,“failed”:true,“msg”:“gpg:找不到有效的OpenPGP数据 . ”,“rc”:2,“stderr “:”gpg:找不到有效的OpenPGP数据 . \ n“,”stdout“:”“,”stdout_lines“:[]}

.yml文件是这样的:

- name: Add the webupd8 APT repository key
  tags:
    - java
    - java-webupd8
  apt_key: data="{{ lookup('file', 'webupd8.key.asc') }}" state=present
  # Use a static file because right now using just an ID fails

- name: Add the webupd8 APT repository
  tags:
    - java
    - java-webupd8
  apt_repository: repo="deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" state=present

好吧,我想这是因为我在 apt_key 变量中输入了错误的值,但我不知道应该把它放在什么上 .

提前致谢

1 回答

  • 1

    我不确定“使用ID失败”的评论意味着什么,但您可以使用以下命令添加密钥:

    - name: Add the webupd8 APT repository key
      tags:
        - java
        - java-webupd8
      apt_key:
        keyserver: hkp://keyserver.ubuntu.com:80
        id: EEA14886
    

    ID已发布here .

相关问题