Debian Codegraph @

test/integration/targets/ansible-galaxy-collection/tasks/setup_gpg.yml

raw
1 - name: create empty gpg homedir
2 file:
3 state: "{{ item }}"
4 path: "{{ gpg_homedir }}"
5 mode: 0700
6 loop:
7 - absent
8 - directory
9
10 - when: ansible_facts.distribution == 'MacOSX'
11 block:
12 - name: MACOS | Find brew binary
13 command: which brew
14 register: brew_which
15
16 - name: MACOS | Get owner of brew binary
17 stat:
18 path: >-
19 {{ brew_which.stdout }}
20 register: brew_stat
21
22 - command: brew install gpg
23 become: yes
24 become_user: >-
25 {{ brew_stat.stat.pw_name }}
26 environment:
27 HOMEBREW_NO_AUTO_UPDATE: True
28 notify:
29 - uninstall gpg
30
31 - name: get username for generating key
32 command: whoami
33 register: user
34
35 - name: import public key
36 command:
37 cmd: gpg --no-tty --homedir {{ gpg_homedir }} --import
38 stdin: '{{ pulp_published_repo.gpgkey }}'
39 register: gpg_import
40
41 - command: gpg --no-tty --homedir {{ gpg_homedir }} --list-keys {{ keyid }}
42 vars:
43 keyid: "{{ (gpg_import.stderr_lines | select('match', 'gpg: key ') | first | split).2 | replace(':', '') }}"
44 register: gpg_list_keys
45
46 - name: save gpg user and fingerprint of new key
47 set_fact:
48 gpg_user: ansible-test
49 fingerprint: "{{ gpg_list_keys.stdout_lines[1] | trim }}"