Mount home directories
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
8
roles/home/README.md
Normal file
8
roles/home/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# HOME-NOUNOUS
|
||||
|
||||
Ce rôle permet d'exporter les homes vers les différents serveurs.
|
||||
|
||||
## VARS
|
||||
|
||||
home_nounous:
|
||||
ip: l'ip du serveur nfs
|
31
roles/home/tasks/main.yml
Normal file
31
roles/home/tasks/main.yml
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
- name: Install NFS client
|
||||
apt:
|
||||
update_cache: true
|
||||
name:
|
||||
- nfs-common
|
||||
state: present
|
||||
register: apt_result
|
||||
retries: 3
|
||||
until: apt_result is succeeded
|
||||
|
||||
- name: Create directory home
|
||||
file:
|
||||
path: /home
|
||||
state: directory
|
||||
owner: root
|
||||
group: user
|
||||
mode: 0750
|
||||
|
||||
- name: Deploy nfs systemd mount
|
||||
template:
|
||||
src: systemd/system/home.mount.j2
|
||||
dest: /etc/systemd/system/home.mount
|
||||
mode: 0644
|
||||
|
||||
- name: Load and activate nfs systemd mount
|
||||
systemd:
|
||||
name: home.mount
|
||||
daemon_reload: true
|
||||
enabled: true
|
||||
state: started
|
14
roles/home/templates/systemd/system/home.mount.j2
Normal file
14
roles/home/templates/systemd/system/home.mount.j2
Normal file
@ -0,0 +1,14 @@
|
||||
{{ ansible_header | comment }}
|
||||
[Unit]
|
||||
Description=Mount home
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Mount]
|
||||
What={{ home.ip }}:{{ home.mountpoint }}
|
||||
Where=/home
|
||||
Type=nfs
|
||||
Options=rw,nosuid
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user