]> git.immae.eu Git - perso/Immae/Config/Ansible.git/commitdiff
Monitor home for new files
authorIsmaël Bouya <ismael.bouya@fretlink.com>
Tue, 13 Nov 2018 00:51:03 +0000 (01:51 +0100)
committerIsmaël Bouya <ismael.bouya@fretlink.com>
Sun, 18 Nov 2018 12:20:49 +0000 (13:20 +0100)
ansible.cfg
roles/tools/files/monitor_home.service [new file with mode: 0644]
roles/tools/tasks/main.yml

index 11d1f5e1187e0c486beb545bd7129de4aa24d7c7..b88bd6c5d019849af1746e895d501512a6eff6a3 100644 (file)
@@ -8,3 +8,4 @@ retry_files_save_path = $XDG_CACHE_HOME/ansible
 roles_path = ./roles:./galaxy
 display_skipped_hosts = yes
 display_ok_hosts = false
+gather_subset = !all
diff --git a/roles/tools/files/monitor_home.service b/roles/tools/files/monitor_home.service
new file mode 100644 (file)
index 0000000..6bb0471
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=Monitor home
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/sh -c '/usr/bin/inotifywait -m $HOME $XDG_DATA_HOME $XDG_CONFIG_HOME -e create -e moved_to | while read i j k; do /usr/bin/dunstify -u CRITICAL -t 0 -a "File created in home" "$i$k"; done'
+
+[Install]
+WantedBy=default.target
index e9eb88713ef7ffa6e926fcbdfc6ba8099a6a2ad9..1aef012e728dfdc2efd4e9d4491e0137355702a9 100644 (file)
     dest: $XDG_CONFIG_HOME/systemd/user/
   notify:
     - reload systemd
+- name: monitor home service file
+  copy:
+    src: monitor_home.service
+    dest: "$XDG_CONFIG_HOME/systemd/user/"
+  notify:
+    - reload systemd
 - meta: flush_handlers
+- name: enable monitor home
+  systemd:
+    state: started
+    scope: user
+    name: monitor_home.service
+    enabled: true
 - name: Clone password store
   git:
     dest: "$XDG_DATA_HOME/pass"