blob: 66fe22044abb03dd298745df352f204485d30748 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
- name: create empty gpg homedir
file:
state: "{{ item }}"
path: "{{ gpg_homedir }}"
mode: 0700
loop:
- absent
- directory
- when: ansible_facts.distribution == 'MacOSX'
block:
- name: MACOS | Find brew binary
command: which brew
register: brew_which
- name: MACOS | Get owner of brew binary
stat:
path: >-
{{ brew_which.stdout }}
register: brew_stat
- command: brew install gpg
become: yes
become_user: >-
{{ brew_stat.stat.pw_name }}
environment:
HOMEBREW_NO_AUTO_UPDATE: True
notify:
- uninstall gpg
- name: get username for generating key
command: whoami
register: user
- name: generate key for user with gpg
command: "gpg --no-tty --homedir {{ gpg_homedir }} --passphrase '' --pinentry-mode loopback --quick-gen-key {{ user.stdout }} default default"
- name: list gpg keys for user
command: "gpg --no-tty --homedir {{ gpg_homedir }} --list-keys {{ user.stdout }}"
register: gpg_list_keys
- name: save gpg user and fingerprint of new key
set_fact:
gpg_user: "{{ user.stdout }}"
fingerprint: "{{ gpg_list_keys.stdout_lines[1] | trim }}"
|