--- - name: Install autofs pacman: name: autofs state: present #- name: install nfs # apt: # pkg: nfs-kernel-server # state: present # when: ansible_distribution == 'Debian' # notify: restart nfs-server - name: install nfs pacman: pkg: nfs-utils state: present when: ansible_distribution != 'Debian' notify: restart nfs-client - name: Create NAS share directory file: path: "/media/{{ item.host }}" state: directory with_items: "{{ autofs }}" - name: Activate NAS shares for autofs lineinfile: path: /etc/autofs/auto.master line: "/media/{{ item.host }} /etc/autofs/auto.{{ item.host }} --timeout=60 --browse" with_items: "{{ autofs }}" - name: NAS autofs config file template: src: "files/autofs.{{ item.host }}" dest: "/etc/autofs/auto.{{ item.host }}" with_items: "{{ autofs }}" - name: Enable nfs daemon service: name: nfs-client state: started enabled: yes - name: Enable autofs daemon service: name: autofs state: started enabled: yes