0
votes

I'm trying to install java in a vagrant virtual machine with ansible how I type the "ansible-playbook" command the output return this error:

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": []}

the .yml file is like this:

- 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

Well,I imagine that is because I put the wrong value in apt_key variable, but I don't know what should I put on it.

Thanks in advance

1

1 Answers

1
votes

I'm not sure what you meant by the comment that "using ID fails", but you can add the key using:

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

ID is published here.