diff --git a/handlers/main.yml b/handlers/main.yml index 83b7bce..4cdcec5 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,4 +1,3 @@ --- -- name: restart nfs - service: "name={{ nfs_server_daemon }} state=restarted" - when: nfs_exports|length +- name: reload nfs + command: 'exportfs -ra' diff --git a/tasks/main.yml b/tasks/main.yml index da49312..2419d42 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -21,7 +21,6 @@ - name: Ensure directories to export exist file: 'path="{{ item.strip().split()[0] }}" state=directory' with_items: "{{ nfs_exports }}" - notify: restart nfs - name: Copy exports file. template: @@ -30,12 +29,7 @@ owner: root group: root mode: 0644 - register: nfs_exports_copy - notify: restart nfs - -- name: Restart NFS immediately if exports are updated. - service: "name={{ nfs_server_daemon }} state=restarted" - when: nfs_exports_copy.changed + notify: reload nfs - name: Ensure nfs is running. service: "name={{ nfs_server_daemon }} state=started enabled=yes"