From: Ismaƫl Bouya Date: Tue, 13 Nov 2018 00:51:03 +0000 (+0100) Subject: Monitor home for new files X-Git-Tag: v1.0~17 X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FConfig%2FAnsible.git;a=commitdiff_plain;h=86a3ca82c74c9109594b4d7c4a61f2d804b8ccc0 Monitor home for new files --- diff --git a/ansible.cfg b/ansible.cfg index 11d1f5e..b88bd6c 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -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 index 0000000..6bb0471 --- /dev/null +++ b/roles/tools/files/monitor_home.service @@ -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 diff --git a/roles/tools/tasks/main.yml b/roles/tools/tasks/main.yml index e9eb887..1aef012 100644 --- a/roles/tools/tasks/main.yml +++ b/roles/tools/tasks/main.yml @@ -70,7 +70,19 @@ 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"