latencybit
latencybit

Reputation: 41

Ansible add GPG Keyserver

I need to incorporate these two commands into my ansible script:

  # sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys #######
  # sudo gpg -a --export ####### | sudo apt-key add -

I am referring to this ansible link but I am unable to produce anything that works. I tried this:

apt_key: keyserver=hkp://keys.gnupg.net id=######

and get the following error:

 FAILED! => {"changed": false, "failed": true, "msg": "unsupported parameter for module: keyserver"}

Is there a way to properly add gpg keys with ansible?

Upvotes: 3

Views: 8004

Answers (1)

Andrew Figaroa
Andrew Figaroa

Reputation: 41

Check this link: http://docs.ansible.com/ansible/latest/apt_key_module.html

- name: convert gpg
  shell: "{{ item }}"
  with_items:
    - gpg --keyserver hkp://keys.gnupg.net --recv-keys #######
    - gpg -a --export ####### | sudo apt-key add -

Upvotes: 4

Related Questions