aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/noheat/cluster-rke/ansible/roles/setup_nfs/tasks/main.yml
blob: 2d8d0b006060da2572e6b3d0c16de4406d857d95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
- name: Install NFS common
  apt:
    name: nfs-common
    state: present
  when: nfs_role is defined

- name: Install NFS server
  apt:
    name: nfs-kernel-server
    state: present
  when: nfs_role is defined and nfs_role == "server"

- name: Umount
  ansible.posix.mount:
    path: "{{ nfs_mountpoint }}"
    state: unmounted
  ignore_errors: yes

- name: Remove leftovers
  file:
    path: "{{ nfs_mountpoint }}"
    state: absent
  when: nfs_role is defined

- name: Create dockerdata directory
  file:
    path: "{{ nfs_mountpoint }}"
    state: directory
    mode: '0777'
    owner: nobody
    group: nogroup
  when: nfs_role is defined

- name: Configure NFS server
  template:
    src: "exports.j2"
    dest: "/etc/exports"
    owner: root
    group: root
    mode: '0644'
  when: nfs_role is defined and nfs_role == "server"

- name: Restart NFS server
  service:
    name: nfs-kernel-server
    state: restarted
    enabled: yes
  when: nfs_role is defined and nfs_role == "server"

- name: Configure NFS clients
  mount:
    path: "{{ nfs_mountpoint }}"
    src: "{{ hostvars[groups['nfs'][0]]['ansible_default_ipv4']['address'] }}:{{ nfs_mountpoint }}"
    fstype: nfs
    opts: auto,nofail,noatime,nolock,intr,tcp,actimeo=1800
    dump: 0
    passno: 0
    state: mounted
  when: nfs_role is defined and nfs_role == "client"