--- - name: "Create exports if necessary" file: dest={{ item.src }} state=directory mode=755 owner=root group=root become: true with_items: "{{ exportList }}" ignore_errors: true - name: "create the exports file" copy: dest=/etc/exports src=files/etcExports mode=644 owner=root group=root become: true become_user: root - name: "Starting rpcbind" service: "name=rpcbind state=started enabled=true" become: true when: ansible_os_family == "RedHat" - name: "Start the Server" service: "name=nfs state=started" become: true when: ansible_os_family == "RedHat" - name: "Enable the Server at boot" service: "name=nfs enabled=true" become: true when: ansible_os_family == "RedHat" and ansible_distribution_major_version < "7" - name: "Enable the Server at boot" service: "name=nfs-server.service enabled=true" become: true when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7" - name: "Run exportfs" command: /usr/sbin/exportfs -a become: true when: ansible_os_family == "Debian" - name: "Start the Server" service: "name=nfs-kernel-server state=started enabled=true" become: true when: ansible_os_family == "Debian"