{%- if pillar['mount'] is defined -%} {%- if pillar['mount']['ext4'] is defined -%} {%- for mount in pillar['mount']['ext4'] -%} {%- set device=pillar['mount']['ext4'][mount]['device'] -%} {{ mount }}: mount.mounted: - device: {{ device }} - fstype: ext4 - mkmnt: True - opts: rw,relatime,data=ordered - hidden_opts: rw,relatime,data=ordered - dump: 0 - pass_num: 2 - persist: True {%- endfor -%} {% endif %} {%- if pillar['mount']['sshfs'] is defined %} sshfs: pkg.installed {% for mount in pillar['mount']['sshfs'] %} {%- if pillar['mount']['sshfs'][mount]['user'] is defined -%} {%- set user=pillar['mount']['sshfs'][mount]['user'] -%} {%- else -%} {%- set user="mount" -%} {%- endif -%} {%- set host=pillar['mount']['sshfs'][mount]['host'] -%} {%- set dir=pillar['mount']['sshfs'][mount]['directory'] %} {{ mount }}_key: file.managed: - name: /root/.ssh/{{user}}_key - source: salt://systems/core/mount/keys/{{user}}_key - user: root - group: root - mode: 600 - makedirs: true {{ mount }}: file.directory: [] mount.mounted: - device: {{user}}@{{host}}:{{dir}} - fstype: fuse.sshfs - mkmnt: True - opts: allow_other,user,IdentityFile=/root/.ssh/{{user}}_key,delay_connect,x-systemd.automount,_netdev,idmap=user,reconnect - hidden_opts: allow_other,user,IdentityFile=/root/.ssh/{{user}}_key,delay_connect,x-systemd.automount,_netdev,idmap=user,reconnect - dump: 0 - pass_num: 2 - persist: True {%- endfor -%} {% endif %} {%- if pillar['mount']['nfs'] is defined -%} nfs-utils: pkg.installed rpcbind: service.running: - enable: true nfs-client.target: service.running: - enable: true remote-fs.target: service.running: - enable: true {% for mount in pillar['mount']['nfs'] %} {%- set host=pillar['mount']['nfs'][mount]['host'] -%} {%- set dir=pillar['mount']['nfs'][mount]['directory'] %} {{ mount }}: mount.mounted: - device: {{host}}:{{dir}} - fstype: nfs - mkmnt: True - opts: defaults,noauto,,x-systemd.timeout=10,x-systemd.automount - hidden_opts: defaults,noauto,,x-systemd.timeout=10,x-systemd.automount - dump: 0 - pass_num: 2 - persist: True {%- endfor -%} {% endif %} {%- endif -%}