description: AutoFS server for SunHPC clusters
copyright: |
  Copyright (c) 2026 SunHPC Project.
  Licensed under Apache 2.0.

stages:
  post:
    - type: file
      path: /etc/auto.master
      content: |
        /share /etc/auto.share --timeout=1200
        /home  /etc/auto.home  --timeout=1200

    - type: file
      path: /etc/auto.share
      content: |
        apps {{ .Node.Hostname }}.{{ .Cluster.Domain }}:/export/&

    - type: script
      content: |
        mkdir -p /export/apps
        echo "AutoFS 配置已生成"

  configure:
    - type: script
      condition: "{{ if .Node.OldHostname }}true{{ end }}"
      content: |
        sed -i 's/{{ .Node.OldHostname }}/{{ .Node.Hostname }}/g' /etc/auto.share
        systemctl restart autofs