5 path: "$XDG_CONFIG_HOME/{{ item }}"
11 src: "gnupg/{{ item }}"
12 dest: "$XDG_CONFIG_HOME/gnupg/{{ item }}"
15 - name: gpg config file
18 dest: "$XDG_CONFIG_HOME/gnupg/gpg.conf"
19 - name: Get gnupg runtime folder name
20 shell: 'gpgconf --list-dirs socketdir | sed -e "s@$XDG_RUNTIME_DIR/gnupg/@@"'
21 register: gnupg_runtime_dir_cmd
24 - name: check existing secret key
25 tags: ["no_bootstrap"]
26 shell: "gpg --list-secret-keys | grep '{{ gpg_useremail }}'"
31 - name: Ask for gpg password
32 when: gpgkeys is defined and gpgkeys.stdout == ""
34 - name: Ask for gpg password
36 prompt: "Chose gpg password"
38 register: gpg_password
39 - name: Confirm gpg password
41 prompt: "Confirm gpg password"
43 register: gpg_password_confirm
44 - name: check gpg password
46 that: gpg_password_confirm.user_input == gpg_password.user_input
47 - name: Generate gpg key
48 when: gpgkeys is defined and gpgkeys.stdout == ""
50 - name: Copy default template for gpg key generation
52 src: gen-key-script.j2
53 dest: "$XDG_CONFIG_HOME/gnupg/gen-key-script-{{ gpg_user }}"
56 - name: Generate gpg key
57 command: "gpg --batch --gen-key $XDG_CONFIG_HOME/gnupg/gen-key-script-{{ gpg_user }}"
60 - name: Remove template file
62 path: "$XDG_CONFIG_HOME/gnupg/gen-key-script-{{ gpg_user }}"
65 shell: "gpg -K --with-colons {{ gpg_useremail }} | grep '^grp' | cut -d':' -f10"
67 when: gpgkeys is defined and gpgkeys.stdout == ""
69 - notify add key to immae@immae.eu
70 - send key to immae@immae.eu
71 - notify add key to password store
72 - meta: flush_handlers
73 - name: add keygrip to sshcontrol
75 line: "{{ keygrip.stdout }}"
77 dest: "$XDG_CONFIG_HOME/gnupg/sshcontrol"
80 when: keygrip is defined and "stdout" in keygrip and keygrip.stdout != ""
83 - meta: flush_handlers
84 - name: Override the gpg socket directory
86 - name: Add systemd overrides directory
88 path: "$XDG_CONFIG_HOME/systemd/user/{{ item }}.socket.d"
96 - name: Add systemd overrides
98 src: "systemd/{{ item }}.conf.j2"
99 dest: "$XDG_CONFIG_HOME/systemd/user/{{ item }}.socket.d/override.conf"
107 - name: Restart systemd units
112 name: "{{ item }}.socket"
113 loop: "{{ results.results|selectattr('changed')|map(attribute='item')|list }}"