---
# tasks file for nfs
- hosts: nfsserver
  gather_facts: no
  become: yes
  handlers:
    - name: restart nfs
      service: 
        name: nfs-kernel-server
        state: restarted
  tasks:
    - name: install nfs server
      apt:
        name: ['nfs-kernel-server']
        state: present

    - name: Create nfs directory to share
      file: 
        path: "/ansible_shares/fruit"
        state: directory

    - name: Make sure that new thing is in exports
      lineinfile: 
        path: /etc/exports
        line: "/ansible_shares/fruit    *(rw,sync,no_subtree_check)"
      notify:
        - restart nfs

