added gpg role

This commit is contained in:
2026-06-22 09:52:26 -05:00
parent 969f9703e9
commit bc173b7da9
3 changed files with 33 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
---
galaxy_info:
author: cjr
description: Import GPG keys from private git repo
license: BSD-3-Clause
min_ansible_version: "2.1"
+25
View File
@@ -0,0 +1,25 @@
---
- name: Clone GPG keys repo
ansible.builtin.git:
repo: cjr@git:/home/cjr/git/keys
dest: "{{ ansible_facts['user_dir'] }}/.gpg-keys"
update: true
version: main
- name: Import GPG public key
ansible.builtin.command:
cmd: gpg --import {{ ansible_facts['user_dir'] }}/.gpg-keys/public-key.asc
register: gpg_import_public
changed_when: "'imported' in gpg_import_public.stderr"
- name: Import GPG secret key
ansible.builtin.command:
cmd: gpg --import {{ ansible_facts['user_dir'] }}/.gpg-keys/secret-key.asc
register: gpg_import_secret
changed_when: "'imported' in gpg_import_secret.stderr"
no_log: true
- name: Remove cloned GPG keys
ansible.builtin.file:
path: "{{ ansible_facts['user_dir'] }}/.gpg-keys"
state: absent