-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-nfs-host.yml
89 lines (87 loc) · 2.37 KB
/
setup-nfs-host.yml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
- hosts: base_machines
become: yes
become_method: sudo
vars_files:
- secure.yml
tasks:
# Uncomment and configure the following tasks as needed for NFS server setup
# - name: Install NFS server package
# apt:
# name: nfs-kernel-server
# state: present
# - name: Configure NFS to export /home
# lineinfile:
# path: /etc/exports
# line: "/home aegypti.local(rw,sync,no_root_squash,no_subtree_check)"
# - name: Restart NFS kernel server
# service:
# name: nfs-kernel-server
# state: restarted
- name: Install NFS common package
apt:
name: nfs-common
state: present
- name: Create archive directory
file:
state: directory
path: "/archive"
# Uncomment and configure the following tasks as needed for NFS mounting
# - name: Mount NFS share at /archive/users
# mount:
# backup: yes
# path: /archive/users
# src: 10.0.0.16:/volume1/nfs
# fstype: nfs
# opts: _netdev,auto,nofail,noatime,nolock,intr,tcp,actimeo=1800
# state: mounted
- hosts: aegypti
become: yes
become_method: sudo
tasks:
- name: Install NFS client package
apt:
name: nfs-common
state: present
- name: Create mount point for /home
file:
path: /home
state: directory
- name: Check if /home is empty
find:
paths: /home
patterns: "*.*"
register: foundFiles
- name: Assert /home is empty
assert:
that: "foundFiles.matched == 0"
msg: "/home must be empty"
- name: Mount NFS share at /home
mount:
backup: yes
path: /home
src: sycorax.local:/home
fstype: nfs
opts: auto,nofail,noatime,nolock,intr,tcp,actimeo=1800
state: mounted
- hosts: docker_containers
become: yes
become_method: sudo
tasks:
- name: Install NFS common package
apt:
name: nfs-common
state: present
- name: Create archive directory
file:
state: directory
path: "/archive"
- name: Mount NFS share at /archive/users
mount:
backup: yes
path: /archive/users
src: 10.0.0.16:/volume1/nfs
fstype: nfs
opts: _netdev,auto,nofail,noatime,nolock,intr,tcp,actimeo=1800
state: mounted
vars_files:
- secure.yml