Add state for NFS server
This commit is contained in:
parent
9e50cc7a7f
commit
50cbea2abe
2 changed files with 59 additions and 0 deletions
15
states/nfsserver/exports
Normal file
15
states/nfsserver/exports
Normal file
|
@ -0,0 +1,15 @@
|
|||
# /etc/exports: the access control list for filesystems which may be exported
|
||||
# to NFS clients. See exports(5).
|
||||
#
|
||||
# Example for NFSv2 and NFSv3:
|
||||
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
|
||||
#
|
||||
# Example for NFSv4:
|
||||
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
|
||||
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
|
||||
#
|
||||
|
||||
{{ nfs_root }} *(rw,async,fsid=root,crossmnt,no_subtree_check)
|
||||
{{ nfs_root }}/web web(rw,async,no_root_squash,no_subtree_check)
|
||||
{{ nfs_root }}/mail mail(rw,async,no_subtree_check) migimap(rw,async,no_subtree_check)
|
||||
|
44
states/nfsserver/init.sls
Normal file
44
states/nfsserver/init.sls
Normal file
|
@ -0,0 +1,44 @@
|
|||
{% set nfs_root = salt['pillar.get']('nfsserver:nfsroot', '/srv/nfs4') -%}
|
||||
|
||||
nfs-kernel-server:
|
||||
pkg:
|
||||
- installed
|
||||
service:
|
||||
- running
|
||||
- enable: True
|
||||
- require:
|
||||
- pkg: nfs-kernel-server
|
||||
|
||||
{{ nfs_root }}:
|
||||
file.directory:
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 0755
|
||||
|
||||
{{ nfs_root }}/mail:
|
||||
file.directory:
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 0751
|
||||
- require:
|
||||
- file: {{ nfs_root }}
|
||||
|
||||
{{ nfs_root }}/web:
|
||||
file.directory:
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 0751
|
||||
- require:
|
||||
- file: {{ nfs_root }}
|
||||
|
||||
/etc/exports:
|
||||
file.managed:
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 0644
|
||||
- template: jinja
|
||||
- context:
|
||||
nfs_root: {{ nfs_root }}
|
||||
- source: salt://nfsserver/exports
|
||||
- watch_in:
|
||||
- service: nfs-kernel-server
|
Loading…
Reference in a new issue