diff --git a/handlers/main.yml b/handlers/main.yml index 555b072..8fed451 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,3 +1,3 @@ --- -- name: restart nfs server +- name: restart nfs service: "name={{ nfs_server_daemon }} state=restarted" diff --git a/tasks/configure-Debian.yml b/tasks/configure-Debian.yml deleted file mode 100644 index a5cc7be..0000000 --- a/tasks/configure-Debian.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- name: Ensure NFS is running. - service: name=nfs-kernel-server state=started enabled=yes - when: nfs_exports diff --git a/tasks/configure-RedHat.yml b/tasks/configure-RedHat.yml deleted file mode 100644 index 7ae72d3..0000000 --- a/tasks/configure-RedHat.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Ensure rpcbind and nfs are running. - service: "name={{ item }} state=started enabled=yes" - with_items: - - rpcbind - - nfs - when: nfs_exports diff --git a/tasks/main.yml b/tasks/main.yml index 1bdc94f..fe18f07 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -17,11 +17,12 @@ owner: root group: root mode: 0644 - notify: restart nfs server + notify: restart nfs # Configuration tasks. -- include: configure-RedHat.yml - when: ansible_os_family == 'RedHat' - -- include: configure-Debian.yml - when: ansible_os_family == 'Debian' +- name: Ensure rpcbind and nfs are running. + service: "name={{ item }} state=started enabled=yes" + with_items: + - rpcbind + - "{{ nfs_server_daemon }}" + when: nfs_exports|length diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 0405359..9c930df 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -4,7 +4,3 @@ with_items: - nfs-common - nfs-kernel-server - -# This isn't necessary until exports are configured in /etc/exports. -# - name: Ensure NFS is running. -# service: name=nfs-kernel-server state=started enabled=yes diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index 245ff03..db9a843 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -1,10 +1,3 @@ --- - name: Ensure NFS utilities are installed. yum: name=nfs-utils state=installed - -# This isn't necessary until exports are configured in /etc/exports. -# - name: Ensure rpcbind and nfs are running. -# service: "name={{ item }} state=started enabled=yes" -# with_items: -# - rpcbind -# - nfs