[nfs-mount] generic systemd nfs mount service

certbot_on_virtu
_shirenn 2021-06-03 23:50:08 +02:00 committed by Yohann D'ANELLO
parent 6491256620
commit 6fa8f17d0c
Signed by: _ynerant
GPG Key ID: 3A75C55819C8CF85
13 changed files with 71 additions and 64 deletions

View File

@ -1,4 +1,10 @@
---
glob_home_nounou:
ip: 172.16.10.1
mountpoint: /pool/home
mounts:
- ip: 172.16.10.1
mountpoint: /pool/home
target: /home_nounou
name: home_nounou
owner: root
group: _user
mode: '0750'

View File

@ -4,6 +4,16 @@ interfaces:
srv_nat: ens19
san: ens20
loc_nfs_mount:
mounts:
- ip: 172.16.4.1
mountpoint: /pool/mirror
target: /mirror
name: mirror
owner: root
group: root
mode: '0750'
loc_ftpsync: {}
loc_rsync_mirror: {}

View File

@ -4,6 +4,16 @@ interfaces:
san: ens19
srv: ens20
loc_nfs_mount:
mounts:
- ip: 172.16.4.1
mountpoint: /pool/mirror
target: /mirror
name: mirror
owner: root
group: root
mode: '0750'
loc_nginx:
service_name: ptf
ssl: []

View File

@ -19,3 +19,20 @@ loc_crans_scripts:
group: nounou
dests:
- /usr/scripts
loc_nfs_mount:
mounts:
- ip: 172.16.4.2
mountpoint: /pool/home
target: /home
name: home
owner: root
group: user
mode: '0750'
- ip: 172.16.4.2
mountpoint: /pool/mail
target: /var/mail
name: var-mail
owner: root
group: user
mode: '0750'

View File

@ -0,0 +1,8 @@
#!/usr/bin/env ansible-playbook
---
# Deploy nfs_mount server
- hosts: all
vars:
nfs_mount: "{{ glob_nfs_mount | default({}) | combine(loc_nfs_mount | default({})) }}"
roles:
- nfs-mount

View File

@ -40,9 +40,9 @@
- hosts: server,!ovh_physical,!tealc.adm.crans.org,!zamok.adm.crans.org,!gulp.cachan-adm.crans.org
vars:
home_nounou: "{{ glob_home_nounou | default({}) | combine(loc_home_nounou | default({})) }}"
nfs_mount: "{{ glob_home_nounou | default({}) | combine(loc_home_nounou | default({})) }}"
roles:
- home-nounou
- nfs-mount
- hosts: all, !rsyslog_server
vars:

View File

@ -1,6 +1,8 @@
#!/usr/bin/env ansible-playbook
---
- import_playbook: nfs_mount.yml
- hosts: adh_server
vars:
adh: '{{ glob_adh | combine(loc_adh | default({}), recursive=True) }}'
@ -8,4 +10,3 @@
- zamok-tools
- postfix
- prometheus-node-exporter-postfix

View File

@ -1,14 +0,0 @@
{{ ansible_header | comment }}
[Unit]
Description=Mount home
Wants=network-online.target
After=network-online.target
[Mount]
What={{ home_nounou.ip }}:{{ home_nounou.mountpoint }}
Where=/home_nounou
Type=nfs
Options=rw,nosuid
[Install]
WantedBy=multi-user.target

View File

@ -1,20 +0,0 @@
---
- name: Deploy nfs systemd mount
template:
src: systemd/system/home.mount.j2
dest: /etc/systemd/system/home.mount
mode: 0755
- name: Load and activate nfs home systemd mount
systemd:
name: home.mount
daemon_reload: true
enabled: true
state: started
- name: Load and activate nfs mail systemd mount
systemd:
name: var-mail.mount
daemon_reload: true
enabled: true
state: started

View File

@ -1,14 +0,0 @@
{{ ansible_header | comment }}
[Unit]
Description=Mount pool/mail on cameron
Wants=network-online.target
After=network-online.target
[Mount]
What=cameron.san.crans.org:/pool/mail
Where=/var/mail
Type=nfs
Options=rw,nosuid
[Install]
WantedBy=multi-user.target

View File

@ -9,23 +9,26 @@
retries: 3
until: apt_result is succeeded
- name: Create directory home_nounou
- name: Create target directory
file:
path: /home_nounou
path: "{{ item.target }}"
state: directory
owner: root
group: _user
mode: 0750
owner: "{{ item.owner }}"
group: "{{ item.group }}"
mode: "{{ item.mode }}"
loop: "{{ nfs_mount.mounts }}"
- name: Deploy nfs systemd mount
template:
src: systemd/system/home_nounou.mount.j2
dest: /etc/systemd/system/home_nounou.mount
src: systemd/system/nfs.mount.j2
dest: "/etc/systemd/system/{{ item.name }}.mount"
mode: 0644
loop: "{{ nfs_mount.mounts }}"
- name: Load and activate nfs systemd mount
systemd:
name: home_nounou.mount
name: "{{ item.name }}.mount"
daemon_reload: true
enabled: true
state: started
loop: "{{ nfs_mount.mounts }}"

View File

@ -1,12 +1,12 @@
{{ ansible_header | comment }}
[Unit]
Description=Mount pool/home on cameron
Description=Mount {{ item.target }}
Wants=network-online.target
After=network-online.target
[Mount]
What=cameron.san.crans.org:/pool/home
Where=/home
What={{ item.ip }}:{{ item.mountpoint }}
Where={{ item.target }}
Type=nfs
Options=rw,nosuid