diff --git a/nfs/files/exports b/nfs/files/exports index 95c8622..cf3c9b4 100644 --- a/nfs/files/exports +++ b/nfs/files/exports @@ -3,6 +3,18 @@ # Your changes will be overwritten. ######################################################################## # -{% for dir, opts in salt['pillar.get']('nfs:server:exports', {}).items() -%} +{%- for dir, opts in salt['pillar.get']('nfs:server:exports', {}).items() %} +{%- if opts is string %} {{ dir }} {{ opts }} -{% endfor -%} +{%- elif opts is mapping %} +{{ dir }} +{%- for host, options in opts.items() -%} +{{ ' ' ~ host }}( +{%- if options is iterable and options is not string -%} +{{ ','.join(options) }} +{%- else -%} +{{ options }} +{%- endif -%}) +{%- endfor -%} +{%- endif %} +{%- endfor %} diff --git a/pillar.example b/pillar.example index ff0694f..55b6d84 100644 --- a/pillar.example +++ b/pillar.example @@ -13,6 +13,13 @@ nfs: /srv/homes: >- hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check) + /srv/cats: + hostname1: + - async + - nohide + hostname2: rw + /srv/dogs: + hostname1: nohide # FreeBSD specific: mountd_flags: -l -S