--- # file: roles/nfs-client/tasks/main.yml - name: ensure nfs client utils are installed apt: name="{{ item }}" state=installed with_items: - nfs-common - libgssrpc4 - librpcsecgss3 - autofs tags: - nfs-client - packages - name: ensure the nfs-common service is configured for nfs4 copy: src=nfs-common dest=/etc/default/nfs-common owner=root group=root mode=0644 notify: - restart nfs-common - restart autofs tags: - nfs-client - config - name: ensure we use the idmapper copy: content="N" dest=/sys/module/nfs/parameters/nfs4_disable_idmapping notify: - restart nfs-common - restart autofs tags: - nfs-client - config - name: ensure we use the idmapper after a reboot copy: src=modprobe-nfs.conf dest=/etc/modprobe.d/nfs.conf owner=root group=root mode=0644 tags: - nfs-client - config - name: ensure the kernel key storage quote used for idmapping is sufficiently high sysctl: name=kernel.keys.root_maxkeys state=present value=1000 # default is 200, this quote was reached when: debian_version == "jessie" notify: - reload sysctl tags: - nfs-client - sysctl - config - name: stretch has a reasonable default value for the kernel key storage size sysctl: name=kernel.keys.root_maxkeys state=absent when: debian_version == "stretch" notify: - reload sysctl tags: - nfs-client - sysctl - config - name: ensure nfs-common is enabled service: name=nfs-common state=running enabled=yes tags: - nfs-client - service - name: ensure there is a base directory for automount file: state=directory path=/net owner=root group=root mode=0755 notify: - restart autofs tags: - nfs-client - name: ensure automounter is configured copy: src=auto.master dest=/etc/auto.master owner=root group=root mode=0644 notify: - restart autofs tags: - nfs-client - config - name: ensure mounts from central storage are available template: src=auto.nfs.j2 dest=/etc/auto.nfs owner=root group=root mode=0644 notify: - restart autofs tags: - nfs-client - config - name: ensure automounter is enabled service: name=autofs state=running enabled=yes tags: - nfs-client - service - name: ensure linking of netdirs file: src="/net/{{ item.netdir }}" dest="/{{ item.dest }}" state=link force=yes with_items: "{{ nfs_shares }}" tags: - nfs-client - name: configure default umask and other user related stuff copy: src=login.defs dest=/etc/login.defs owner=root group=root mode=0644 tags: - nfs-client - umask - config - meta: flush_handlers