Monty Taylor 6271966f10
Add role to GPG sign artifacts in a directory
This will sign everything in the artifacts directory.

Change-Id: I1f07b1b05ff4336e32469f85ff2c09fb72c0b51c
2017-08-22 19:24:05 -04:00

27 lines
630 B
YAML

- name: Make GPG directory
tempfile:
state: directory
register: gnupg_tmpdir
- name: Create GPG pubring
copy:
content: "{{ gpg_key.pubring }}"
dest: "{{ gnupg_tmpdir.path }}/pubring.gpg"
mode: 0400
- name: Create GPG secring
copy:
content: "{{ gpg_key.secring }}"
dest: "{{ gnupg_tmpdir.path }}/secring.gpg"
mode: 0400
- name: Find files to sign
find:
paths: "{{ gpg_sign_path }}"
register: artifacts
- name: Sign artifacts
command: "gpg --homedir {{ gnupg_tmpdir.path }} --armor --detach-sign {{ item.path }}"
with_items: "{{ artifacts.files }}"
when: artifacts.matched|bool