Skip to content

Commit

Permalink
feat(config): support options as data structure
Browse files Browse the repository at this point in the history
Support the passing of arguments to an exported directory using
a proper data structure to facilitate a more uniform configuration
and to allow users to utilize pillar merging of hosts/options.

Signed-off-by: Georg Pfuetzenreuter <[email protected]>
  • Loading branch information
tacerus committed Feb 15, 2024
1 parent 4f9a8c3 commit a3d755c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
16 changes: 14 additions & 2 deletions nfs/files/exports
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
7 changes: 7 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a3d755c

Please sign in to comment.