From f9e9f5ca5f19ad3c74fac09b6779aff7d7cddf83 Mon Sep 17 00:00:00 2001
From: Chris Hines <chris.hines@monash.edu>
Date: Thu, 16 Apr 2015 01:08:30 +0000
Subject: [PATCH] fix up the NFS related tasks, so that the server definitly
 restarts after the exports are written and the mounting of filesystems on
 clients is correct

---
 roles/nfs-client/tasks/mountFileSystem.yml |  5 +----
 roles/syncExports/tasks/addExports.yml     | 12 ++++++++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/roles/nfs-client/tasks/mountFileSystem.yml b/roles/nfs-client/tasks/mountFileSystem.yml
index 0dc48290..53abd33d 100644
--- a/roles/nfs-client/tasks/mountFileSystem.yml
+++ b/roles/nfs-client/tasks/mountFileSystem.yml
@@ -3,11 +3,8 @@
   service: name=fail2ban state=stopped
   sudo: true
 
-
-
-
 - name: "Mounting NFS mounts"
-  mount: name={{ item.mntpt }} src={{ item.src }} fstype={{ item.fstype }} opts={{ item.opts }} state=mounted
+  mount: name={{ item.name }} src=" {{ item.ipv4 }}:{{ item.src }} " fstype={{ item.fstype }} opts={{ item.opts }} state=mounted
   with_items: nfsMounts
   notify: "restart authentication"
   notify: "restart rpcbind"
diff --git a/roles/syncExports/tasks/addExports.yml b/roles/syncExports/tasks/addExports.yml
index 8853541b..79484a27 100644
--- a/roles/syncExports/tasks/addExports.yml
+++ b/roles/syncExports/tasks/addExports.yml
@@ -8,11 +8,15 @@
   template: src=exports.j2 dest=/etc/exports owner=root group=root mode=644
   sudo: true
 
-# Do not do this as a handler, instead do this here as a task so that it happens imediatly after the exports file is created before any clients
-# attempt a mount
-- name : "Reload exports"
-  command: exportfs -ra
+- name: "Start the Server"
+  service: "name=nfs state=restarted"
   sudo: true
+  when: ansible_os_family == "RedHat"
+
+- name: "Start the Server"
+  service: "name=nfs-kernel-server state=restarted"
+  sudo: true
+  when: ansible_os_family == "Debian"
 
 - name : "Pause ... clients sometimes have errors"
   command: sleep 60
-- 
GitLab