【问题标题】:Error instaling java in a VM.(Vagrant & Ansible)在 VM 中安装 java 时出错。(Vagrant 和 Ansible)
【发布时间】:2016-10-18 10:56:20
【问题描述】:

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

失败了! => {“更改”:假,“cmd”:“apt-key add -”,“失败”:真, "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 变量中输入了错误的值,但我不知道应该在上面输入什么。

提前致谢

【问题讨论】:

    标签: java vagrant ansible yaml


    【解决方案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

    【讨论】:

      猜你喜欢
      • 2021-10-27
      • 1970-01-01
      • 2023-03-12
      • 1970-01-01
      • 2015-04-22
      • 2020-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多