Simplify the "Import GPG keys" loop

This commit is contained in:
Kris Lamoureux 2023-10-19 14:09:10 -04:00
parent 2354a8fb8c
commit ac412f16ef
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
2 changed files with 7 additions and 7 deletions

View File

@ -3,8 +3,8 @@ allow_reboot: false
manage_network: false manage_network: false
root_gpgkeys: root_gpgkeys:
# kris@lamoureux.io - name: kris@lamoureux.io
- id: FBF673CEEC030F8AECA814E73EDA9C3441EDA925 id: FBF673CEEC030F8AECA814E73EDA9C3441EDA925
# docker # docker
docker_users: docker_users:

View File

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