rvm1-ansible icon indicating copy to clipboard operation
rvm1-ansible copied to clipboard

Skip downlaoding the gpg if it's already trusted

Open alex opened this issue 10 years ago • 5 comments

This saves on a network round trip (which increases reliability)

alex avatar Sep 14 '15 14:09 alex

I'm having a lot of reliability issues with the key server which is making deploys less fun:

fatal: [example.com]: FAILED! => {"changed": false, "cmd": ["gpg", "--keyserver", "hkp://keys.gnupg.net", "--recv-keys", "D39DC0E3"], "delta": "0:00:00.060225", "end": "2016-06-21 22:57:35.806555", "failed": true, "rc": 2, "start": "2016-06-21 22:57:35.746330", "stderr": "gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net\ngpg: no valid OpenPGP data found.\ngpg: Total number processed: 0", "stdout": "gpgkeys: key D39DC0E3 can't be retrieved", "stdout_lines": ["gpgkeys: key D39DC0E3 can't be retrieved"], "warnings": []}

I can work on this tomorrow.

hut8 avatar Jun 22 '16 02:06 hut8

Do you have an idea to do that?

georf avatar Jul 17 '18 12:07 georf

@georf

Note that the workaround for #196 which I posted on that issue also contains an example of not downloading a key when the key is already trusted.

pjnagel avatar Feb 15 '19 03:02 pjnagel

Thank you. I lost track of it. I did this at my code:


- name: Check imported GPG keys
  command: 'gpg --no-tty --list-keys {{ item }}'
  changed_when: False
  check_mode: False
  when: not ansible_check_mode
  register: gpg_result
  retries: 5
  delay: 5
  ignore_errors: True
  with_items: '{{ rvm1_gpg_keys }}'

- name: Import GPG keys
  command: 'gpg --no-tty --keyserver {{ rvm1_gpg_key_server }} --recv-keys {{ item.item }}'
  when: not ansible_check_mode and item.rc != 0 
  with_items: '{{ gpg_result.results }}'

For this the rvm1_gpg_keys variable have to be an array.

georf avatar Feb 15 '19 08:02 georf

TASK [rvm : Import GPG keys from keyservers] can be super slow at times. Would love to see this change implemented.

mcg avatar May 22 '19 14:05 mcg