main.yml 2.59 KB
Newer Older
Lars Beckers's avatar
Lars Beckers committed
1
2
3
4
---
# file: roles/nfs-client/tasks/main.yml

- name: ensure nfs client utils are installed
5
6
7
8
9
10
  apt: name="{{ item }}" state=installed
  with_items:
    - nfs-common
    - libgssrpc4
    - librpcsecgss3
    - autofs
Robin Sonnabend's avatar
Robin Sonnabend committed
11
12
13
14
  tags:
    - nfs-client
    - packages

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
- 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
Robin Sonnabend's avatar
Robin Sonnabend committed
38

39
40
- 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
41
  when: debian_version == "jessie"
42
43
44
45
46
47
48
  notify:
    - reload sysctl
  tags:
    - nfs-client
    - sysctl
    - config

49
50
51
52
53
54
55
56
57
58
- 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

59
60
61
62
63
64
- name: ensure nfs-common is enabled
  service: name=nfs-common state=running enabled=yes
  tags:
    - nfs-client
    - service

65
66
67
68
- name: ensure there is a base directory for automount
  file: state=directory path=/net owner=root group=root mode=0755
  notify:
    - restart autofs
Lars Beckers's avatar
Lars Beckers committed
69
  tags:
Robin Sonnabend's avatar
Robin Sonnabend committed
70
    - nfs-client
Lars Beckers's avatar
Lars Beckers committed
71
72
73
74
75

- name: ensure automounter is configured
  copy: src=auto.master dest=/etc/auto.master owner=root group=root mode=0644
  notify:
    - restart autofs
Lars Beckers's avatar
Lars Beckers committed
76
  tags:
Robin Sonnabend's avatar
Robin Sonnabend committed
77
    - nfs-client
Lars Beckers's avatar
Lars Beckers committed
78
    - config
Lars Beckers's avatar
Lars Beckers committed
79
80
81
82
83

- 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
Lars Beckers's avatar
Lars Beckers committed
84
  tags:
85
    - nfs-client
Lars Beckers's avatar
Lars Beckers committed
86
87
88
89
90
    - config

- name: ensure automounter is enabled
  service: name=autofs state=running enabled=yes
  tags:
Robin Sonnabend's avatar
Robin Sonnabend committed
91
    - nfs-client
Lars Beckers's avatar
Lars Beckers committed
92
    - service
Lars Beckers's avatar
Lars Beckers committed
93

94
95
96
- name: ensure linking of netdirs
  file: src="/net/{{ item.netdir }}" dest="/{{ item.dest }}" state=link force=yes
  with_items: "{{ nfs_shares }}"
Lars Beckers's avatar
Lars Beckers committed
97
  tags:
Robin Sonnabend's avatar
Robin Sonnabend committed
98
    - nfs-client
Lars Beckers's avatar
Lars Beckers committed
99

100
101
- name: configure default umask and other user related stuff
  copy: src=login.defs dest=/etc/login.defs owner=root group=root mode=0644
Lars Beckers's avatar
Lars Beckers committed
102
  tags:
Robin Sonnabend's avatar
Robin Sonnabend committed
103
    - nfs-client
104
105
    - umask
    - config
Lars Beckers's avatar
Lars Beckers committed
106

107
- meta: flush_handlers