mirror of
https://github.com/geerlingguy/ansible-role-nfs
synced 2024-12-12 20:20:18 +01:00
Use exportfs -ra instead of restarting the NFS service to avoid breaking already existing mounts
This commit is contained in:
parent
f2778aa96f
commit
8e7803392f
2 changed files with 3 additions and 10 deletions
|
@ -1,4 +1,3 @@
|
||||||
---
|
---
|
||||||
- name: restart nfs
|
- name: reload nfs
|
||||||
service: "name={{ nfs_server_daemon }} state=restarted"
|
command: 'exportfs -ra'
|
||||||
when: nfs_exports|length
|
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
- name: Ensure directories to export exist
|
- name: Ensure directories to export exist
|
||||||
file: 'path="{{ item.strip().split()[0] }}" state=directory'
|
file: 'path="{{ item.strip().split()[0] }}" state=directory'
|
||||||
with_items: "{{ nfs_exports }}"
|
with_items: "{{ nfs_exports }}"
|
||||||
notify: restart nfs
|
|
||||||
|
|
||||||
- name: Copy exports file.
|
- name: Copy exports file.
|
||||||
template:
|
template:
|
||||||
|
@ -30,12 +29,7 @@
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
register: nfs_exports_copy
|
notify: reload nfs
|
||||||
notify: restart nfs
|
|
||||||
|
|
||||||
- name: Restart NFS immediately if exports are updated.
|
|
||||||
service: "name={{ nfs_server_daemon }} state=restarted"
|
|
||||||
when: nfs_exports_copy.changed
|
|
||||||
|
|
||||||
- name: Ensure nfs is running.
|
- name: Ensure nfs is running.
|
||||||
service: "name={{ nfs_server_daemon }} state=started enabled=yes"
|
service: "name={{ nfs_server_daemon }} state=started enabled=yes"
|
||||||
|
|
Loading…
Reference in a new issue