Mount home directories

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
2021-05-24 20:51:07 +02:00
parent 0a85cd22ff
commit 3fedc63db3
6 changed files with 65 additions and 0 deletions

8
roles/home/README.md Normal file
View 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
View 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

View 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