znerol.gpg_export
Ansible Role: GPG Export
This role provides a tool to find GPG public keys.
Requirements
You need to have GnuPG installed on the control machine.
Optional Lookup Parameters
executable: This is the full path to the gpg program. By default, it is set to/usr/bin/gpg(for Ansible versions less than 2.7) or will be found automatically in thePATHvariable (for Ansible version 2.7 and above).homedir: Path to the GnuPG home directory (refer to man 1 gpg). By default, it uses GnuPG's standard directory (~/.gnupg).armor: If set to produce ASCII armored output (refer to man 1 gpg). Default isTrue.export_options: A list of settings for the exported keys (refer to man 1 gpg).match: Determines how keys are matched to the specified UIDs. Options includedefault,exact_uid,exact_email, andpartial_email. (refer to man 1 gpg)
Dependencies
None
Example Playbook
Here’s how to use the gpg_export lookup:
- hosts: webservers
tasks:
- import_role:
name: znerol.gpg_export
- name: Publish GPG keys on webserver
loop:
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "äëöüï@example.org"
- "[email protected]"
copy:
content: "{{ lookup('gpg_export', item, armor=True, match='exact_uid') }}"
dest: "/var/www/{{ item }}.asc"
Check test/test.yml for examples of input and output.
License
MIT
