-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmicro_wd_nfs.yml
141 lines (127 loc) · 2.67 KB
/
micro_wd_nfs.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
- hosts: localhost
connection: local
name: PERFORM CONFIGURATION NFS EXPORTS FROM WESTERN DIGITAL EXTERNAL DISK
gather_facts: no
become: yes
vars:
# Explicitly telling Ansible to use Python3, because of the bug below:
# # https://github.com/ansible/ansible/issues/54855
- ansible_python_interpreter: /usr/bin/python3
tasks:
- name: Create the mount point for both volumes
file:
path: '{{ item }}'
state: directory
owner: root
group: root
mode: '0755'
loop:
- /mnt/sg3/
- /mnt/wd_xfs1/
- /mnt/martinbackup/
- /mnt/sg1/
- /srv/nfs4/sg3/
- /srv/nfs4/wd_xfs1/
tags:
- nfs
- martin
- name: Mount the filesystem for media/backups
mount:
path: /mnt/sg3
src: LABEL=WD_SG3
fstype: ext4
state: mounted
backup: yes
tags:
- nfs
- name: Mount the filesystem for laptop image backups
mount:
path: /mnt/wd_xfs1
src: LABEL=WD_XFS1
fstype: xfs
state: mounted
backup: yes
tags:
- nfs
- name: Mount the filesystem for Martin's drive backups
mount:
path: /mnt/martinbackup
src: LABEL=WD_MARTIN
fstype: ext4
state: mounted
backup: yes
tags:
- nfs
- martin
- name: Create the bind mounts
mount:
path: /srv/nfs4/sg3
src: /mnt/sg3
opts: bind
fstype: none
state: mounted
backup: yes
tags:
- nfs
- name: Create the bind mounts
mount:
path: /srv/nfs4/wd_xfs1
src: /mnt/wd_xfs1
opts: bind
fstype: none
state: mounted
backup: yes
tags:
- nfs
- name: Create the LIBNFSIDMAP configuration
lineinfile:
path: /etc/idmapd.conf
regexp: '^#Domain'
line: Domain = nuc.lan
backup: yes
tags:
- nfs
- name: Export the filesystems (/etc/exports)
copy:
src: nfs/exports
dest: /etc/exports
owner: root
group: root
mode: 0644
tags:
- nfs
- name: ENABLE THE NFS SYSTEM SERVICES
systemd:
name: "{{ item }}"
enabled: yes
state: started
loop:
- rpcbind
- nfs-server
tags:
- nfs
- name: Open the appropriate firewall ports
firewalld:
zone: FedoraServer
service: '{{ item }}'
permanent: yes
immediate: yes
state: enabled
loop:
- nfs
- nfs3
- mountd
- rpc-bind
tags:
- nfs
- name: Open the appropriate firewall services for local VMs to access mounts
firewalld:
zone: libvirt
service: '{{ item }}'
permanent: yes
immediate: yes
state: enabled
loop:
- nfs
tags:
- nfs