From 00d2ccada22042429b52ed5b19741a9ce417e5c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Fri, 21 Jul 2017 15:35:34 +0200 Subject: [PATCH] Restart systemd *-fs.target. --- README.md | 1 + handlers/main.yml | 11 +++++++++++ tasks/main.yml | 1 + 3 files changed, 13 insertions(+) create mode 100644 handlers/main.yml diff --git a/README.md b/README.md index 8db383e..cd5d2e5 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ This role will : * Create the mountpoint directory. * Add an entry in `/etc/fstab`. * Ensure to mount the device if specified. +* Restart systemd's filesystem.target to ensure automount device works. ## Development diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..439b539 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,11 @@ +--- +# handlers file for mounts + +- name: restart fs.target + systemd: + name: "{{ item }}" + state: restarted + daemon_reload: yes + with_items: + - local-fs.target + - remote-fs.target diff --git a/tasks/main.yml b/tasks/main.yml index 80599e0..35399d6 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -15,3 +15,4 @@ opts: "{{ item.opts | default(mounts_opts) }}" state: "{{ item.state | default(mounts_state) }}" with_items: "{{ mounts_list }}" + notify: restart fs.target