Add ZFS sharenfs

This commit is contained in:
Daniel A. Maierhofer
2018-07-13 01:10:50 +02:00
parent 19000dbae8
commit 3f491238fc
2 changed files with 34 additions and 4 deletions

View File

@@ -90,13 +90,25 @@ rsync --stats -avhP --exclude-from=/var/tmp/ignorelist root@atlas:/home/ /zv1/ho
rsync --stats -avhP --exclude Pictures root@atlas:/mnt/save/fet_daten/ /zv1/daten/
rsync --stats -avhP root@atlas:/mnt/save/fet_daten/Pictures/ /zv1/fotos/
```
### Share via NFS
```shell
zfs set sharenfs="rw=@192.168.86.0/24,insecure,sync,no_subtree_check,root_squash,no_wdelay" zv1/homes
zfs set sharenfs="rw=@192.168.86.0/24,insecure,sync,no_subtree_check,root_squash,crossmnt" zv1/daten
zfs set sharenfs="rw=@192.168.86.0/24,insecure,sync,no_subtree_check,root_squash,crossmnt" zv1/fotos
showmount -e
```
### Before reinstalling
```shell
zfs export
```
### After reinstalling
```shell
./ansible-playbook -i hosts/production site.yml --tags common --limit ariane
ssh ariane apt-get update && apt-get upgrade && reboot
./ansible-playbook -i hosts/production site.yml --tags zfs --limit ariane
zfs import
zpool import zv1
zfs mount -a
```
## ZFS Maintenance
```shell

View File

@@ -30,11 +30,29 @@
notify: zfs restart
- name: zfs - set quota
zfs: "name={{ item }} state=present quota=1T"
zfs:
name: "{{ item.name }}"
state: present
extra_zfs_properties:
quota: "{{ item.quota }}"
with_items:
- zv1/homes
- zv1/daten
- zv1/fotos
- { name: zv1/homes, quota: "1T" }
- { name: zv1/daten, quota: "1T" }
- { name: zv1/fotos, quota: "1T" }
- name: zfs - install nfs-kernel-server
package: name=nfs-kernel-server
- name: zfs - sharenfs
zfs:
name: "{{ item.name }}"
state: present
extra_zfs_properties:
sharenfs: "{{ item.opts }}"
with_items:
- { name: zv1/homes, opts: "rw=@192.168.86.0/24,insecure,sync,no_subtree_check,root_squash,no_wdelay" }
- { name: zv1/daten, opts: "rw=@192.168.86.0/24,insecure,sync,no_subtree_check,root_squash,crossmnt" }
- { name: zv1/fotos, opts: "rw=@192.168.86.0/24,insecure,sync,no_subtree_check,root_squash,crossmnt" }
- name : zfs - zfs_mount.sh
copy: src=zfs_mount.sh dest=/usr/local/bin/ owner=root group=root mode=0755