summaryrefslogtreecommitdiff
path: root/roles/gnupg/tasks/main.yml
blob: 8adaf697719016f39db9bd1e730a745c6899d813 (plain) (blame)
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
---
- name: Config files
  synchronize:
    recursive: yes
    archive: no
    checksum: yes
    src: gnupg
    dest: /$XDG_CONFIG_HOME/
- name: Protect directory
  file:
    path: $XDG_CONFIG_HOME/gnupg
    state: directory
    mode: 0700
- name: Get gnupg runtime folder name
  shell: 'GNUPGHOME=$XDG_CONFIG_HOME/gnupg gpgconf --list-dirs socketdir | sed -e "s@$XDG_RUNTIME_DIR/gnupg/@@"'
  register: gnupg_runtime_dir_cmd
- name: Add systemd overrides
  template:
    src: "systemd/{{ item }}.conf.j2"
    dest: "$XDG_CONFIG_HOME/systemd/user/{{ item }}.socket.d/override.conf"
  register: results
  loop:
    - dirmngr
    - gpg-agent
    - gpg-agent-browser
    - gpg-agent-extra
    - gpg-agent-ssh
- name: Restart systemd units
  systemd:
    daemon_reload: true
    scope: user
    state: restarted
    name: "{{ item }}.socket"
  loop: "{{ results.results|selectattr('changed')|map(attribute='item')|list }}"