Mount home directories
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
0a85cd22ff
commit
3fedc63db3
4
group_vars/all/home.yml
Normal file
4
group_vars/all/home.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
glob_home:
|
||||
ip: 172.16.42.1
|
||||
mountpoint: /rpool/home
|
@ -4,6 +4,7 @@
|
||||
- import_playbook: apt.yml
|
||||
- import_playbook: ntp.yml
|
||||
- import_playbook: ldap-client.yml
|
||||
- import_playbook: home.yml
|
||||
|
||||
- hosts: all
|
||||
roles:
|
||||
|
7
plays/home.yml
Executable file
7
plays/home.yml
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env ansible-playbook
|
||||
---
|
||||
- hosts: debian
|
||||
vars:
|
||||
home: '{{ glob_home | combine(loc_home | default({})) }}'
|
||||
roles:
|
||||
- home
|
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
|
Loading…
Reference in New Issue
Block a user