java - 在虚拟机中安装 java 时出错。(Vagrant 和 Ansible)

标签 java vagrant ansible yaml

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

FAILED! => {"changed": false, "cmd": "apt-key add -", "failed": true, "msg": "gpg: no valid OpenPGP data found.", "rc": 2, "stderr": "gpg: no valid OpenPGP data found.\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 变量中输入了错误的值,但我不知道应该在上面输入什么。

提前致谢

最佳答案

我不确定您所说的“使用 ID 失败”的含义是什么,但您可以使用以下方式添加 key :

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

ID已发布here .

关于java - 在虚拟机中安装 java 时出错。(Vagrant 和 Ansible),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40106347/

相关文章:

java - 在最新的 Android Studio 中启动 AVD 时出错

java - 当子对象状态影响父状态时处理它

java - 请帮助我在我的 Java 应用程序中过滤掉 Apache Log4j 的第三方日志记录

laravel - 使用带有 vagrant + homestead 的 virtualbox 在虚拟机上缓慢文件上传

vagrant - 主管 : Why am I able to run more than 4 processes on a 4 core machine?

ubuntu - 记录 Ansible 在远程主机上运行 BASH/Python 脚本的日志

python - 使用 Ansible 解析带有命名空间的 XML,特别是 JBOSS standalone.xml

java - Spring javax.validation 注释未在 BindingResult 中捕获

linux - 打包机构建中的 Vagrant 配置

regex - 使用 Ansible 添加 fstab 选项