summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@fretlink.com>2018-11-13 01:51:03 +0100
committerIsmaël Bouya <ismael.bouya@fretlink.com>2018-11-18 13:20:49 +0100
commit86a3ca82c74c9109594b4d7c4a61f2d804b8ccc0 (patch)
treeffe327d5e4b3fec3233c7877d074ec5513b9657f
parente1c588d325f33930d7a98eec97ec41caf6f3d468 (diff)
downloadAnsible-86a3ca82c74c9109594b4d7c4a61f2d804b8ccc0.tar.gz
Ansible-86a3ca82c74c9109594b4d7c4a61f2d804b8ccc0.tar.zst
Ansible-86a3ca82c74c9109594b4d7c4a61f2d804b8ccc0.zip
Monitor home for new files
-rw-r--r--ansible.cfg1
-rw-r--r--roles/tools/files/monitor_home.service9
-rw-r--r--roles/tools/tasks/main.yml12
3 files changed, 22 insertions, 0 deletions
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
8roles_path = ./roles:./galaxy 8roles_path = ./roles:./galaxy
9display_skipped_hosts = yes 9display_skipped_hosts = yes
10display_ok_hosts = false 10display_ok_hosts = false
11gather_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 @@
1[Unit]
2Description=Monitor home
3
4[Service]
5Type=simple
6ExecStart=/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'
7
8[Install]
9WantedBy=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 @@
70 dest: $XDG_CONFIG_HOME/systemd/user/ 70 dest: $XDG_CONFIG_HOME/systemd/user/
71 notify: 71 notify:
72 - reload systemd 72 - reload systemd
73- name: monitor home service file
74 copy:
75 src: monitor_home.service
76 dest: "$XDG_CONFIG_HOME/systemd/user/"
77 notify:
78 - reload systemd
73- meta: flush_handlers 79- meta: flush_handlers
80- name: enable monitor home
81 systemd:
82 state: started
83 scope: user
84 name: monitor_home.service
85 enabled: true
74- name: Clone password store 86- name: Clone password store
75 git: 87 git:
76 dest: "$XDG_DATA_HOME/pass" 88 dest: "$XDG_DATA_HOME/pass"