我正在尝试使用 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/