Verify successful GPG imports

This commit is contained in:
Kris Lamoureux 2023-10-19 13:37:35 -04:00
parent 251a7c0dd5
commit 2354a8fb8c
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925

View File

@ -18,9 +18,20 @@
when: root_gpgkeys is defined when: root_gpgkeys is defined
- name: Import GPG keys - name: Import GPG keys
command: "gpg --keyserver {{ item.server | default('keys.openpgp.org') }} --recv-key {{ item.id }}" command: "gpg --keyserver {{ item.0.server | default('keys.openpgp.org') }} --recv-key {{ item.0.id }}"
loop: "{{ root_gpgkeys }}" register: gpg_check_import
when: root_gpgkeys is defined and gpg_check.results | map(attribute='rc') | list != [0] loop: "{{ root_gpgkeys | zip(gpg_check.results) | list }}"
loop_control:
label: "{{ item.0.id }}"
when: root_gpgkeys is defined and item.1.rc != 0
- name: Check GPG key imports
fail:
msg: "{{ item.stderr }}"
loop: "{{ gpg_check_import.results }}"
loop_control:
label: "{{ item.item.0.id }}"
when: (item.skipped | default(false) == false) and ('imported' not in item.stderr)
- name: Install NTPsec - name: Install NTPsec
ansible.builtin.apt: ansible.builtin.apt: