]> git.immae.eu Git - perso/Immae/Config/Ansible.git/blobdiff - roles/gnupg/tasks/main.yml
Replace synchronize wiht copy
[perso/Immae/Config/Ansible.git] / roles / gnupg / tasks / main.yml
index 2bd1c79ad7e0cfd8ded167909214c8acc4f33bc9..183dd7dd243d5b406c047fb1fed1df43be9fb6f1 100644 (file)
@@ -1,11 +1,13 @@
 ---
 - name: Config files
-  synchronize:
-    recursive: yes
-    archive: no
-    checksum: yes
-    src: gnupg
-    dest: /$XDG_CONFIG_HOME/
+  copy:
+    src: "gnupg/{{ gnupg_config_item }}"
+    dest: "$XDG_CONFIG_HOME/gnupg/{{ gnupg_config_item }}"
+  loop:
+    - gpg-agent.conf
+    - gpg.conf
+  loop_control:
+    loop_var: gnupg_config_item
 - name: Protect directory
   file:
     path: $XDG_CONFIG_HOME/gnupg
@@ -63,6 +65,7 @@
     - notify add key to immae@immae.eu
     - send key to immae@immae.eu
     - notify add key to password store
+- meta: flush_handlers
 - name: add keygrip to sshcontrol
   lineinfile:
     line: "{{ keygrip.stdout }}"
   when: keygrip is defined and "stdout" in keygrip and keygrip.stdout != ""
   notify:
     - restart gpg-agent
+- meta: flush_handlers
 - name: Override the gpg socket directory
   block:
     - name: Add systemd overrides
       template:
-        src: "systemd/{{ item }}.conf.j2"
-        dest: "$XDG_CONFIG_HOME/systemd/user/{{ item }}.socket.d/override.conf"
+        src: "systemd/{{ systemd_item }}.conf.j2"
+        dest: "$XDG_CONFIG_HOME/systemd/user/{{ systemd_item }}.socket.d/override.conf"
       register: results
       loop:
         - dirmngr
         - gpg-agent-browser
         - gpg-agent-extra
         - gpg-agent-ssh
+      loop_control:
+        loop_var: systemd_item
     - name: Restart systemd units
       systemd:
         daemon_reload: true
         scope: user
         state: restarted
-        name: "{{ item }}.socket"
+        name: "{{ restart_systemd_item }}.socket"
       loop: "{{ results.results|selectattr('changed')|map(attribute='item')|list }}"
+      loop_control:
+        loop_var: restart_systemd_item