Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add apt key with --recv-keys instead of --recv?

Tags:

ubuntu

ansible

I want to install facebook osquery with ansible. The instructions for ubuntu are as follows:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C9D8B80B
...

Unfortunately setting the id to C9D8B80B doesn't work. In tasks:

- name: Add repository key
  apt_key: keyserver=keyserver.ubuntu.com id=C9D8B80B state=present

The command fails:

TASK: [osquery | Add repository key] ****************************************** 
failed: [x.x.x.x] => {"cmd": "apt-key adv --keyserver keyserver.ubuntu.com --recv C9D8B80B", "failed": true, "rc": 2}

The difference is --recv C9D8B80B vs --recv-keys C9D8B80B.

Which ansible apt_key option corresponds to --recv-keys?

like image 610
AJcodez Avatar asked Jun 09 '15 17:06

AJcodez


1 Answers

Nevermind, it was a sudo issue. Presumably --recv and --recv-key and --recv-keys are the same option.

The full stack trace is:

stderr: gpg: requesting key C9D8B80B from hkp server keyserver.ubuntu.com
gpg: no writable keyring found: eof
gpg: error reading `[stream]': general error
gpg: Total number processed: 0

To fix added sudo: yes to playbook.

like image 71
AJcodez Avatar answered Sep 19 '22 11:09

AJcodez