Allow configuration of nfs export/mount options
This commit is contained in:
@@ -63,6 +63,13 @@ func Configure(show bool) error {
|
||||
fmt.Fprintf(fstab, "%s:%s %s nfs defaults 0 0\n", controller.Ipaddr, export, export)
|
||||
}
|
||||
|
||||
for _, export := range controller.Nfs.ExportsExtended {
|
||||
fmt.Fprintf(exports, "%s %s/%s(%s)\n", export.Path, controller.Network, controller.Netmask, export.Options)
|
||||
if export.Mount {
|
||||
fmt.Fprintf(fstab, "%s:%s %s nfs defaults 0 0\n", controller.Ipaddr, export.Path, export.Path)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("Enabling and restarting the NFS services\n")
|
||||
if controller.Nfs.SystemdName == "" {
|
||||
err := util.SystemdStart("nfs-server")
|
||||
@@ -81,12 +88,17 @@ func Configure(show bool) error {
|
||||
for _, export := range controller.Nfs.Exports {
|
||||
fmt.Printf("%s %s/%s\n", export, controller.Network, controller.Netmask)
|
||||
}
|
||||
for _, export := range controller.Nfs.ExportsExtended {
|
||||
fmt.Printf("%s %s/%s\n", export.Path, controller.Network, controller.Netmask)
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("SYSTEM OVERLAY: default/etc/fstab:\n")
|
||||
for _, export := range controller.Nfs.Exports {
|
||||
fmt.Printf("%s:%s %s nfs defaults 0 0\n", controller.Ipaddr, export, export)
|
||||
}
|
||||
|
||||
for _, export := range controller.Nfs.ExportsExtended {
|
||||
fmt.Printf("%s:%s %s nfs defaults 0 0\n", controller.Ipaddr, export.Path, export.Path)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -45,9 +45,16 @@ type TftpConf struct {
|
||||
type NfsConf struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
Exports []string `yaml:"exports"`
|
||||
ExportsExtended []*NfsExportConf `yaml:"exports extended"`
|
||||
SystemdName string `yaml:"systemd name"`
|
||||
}
|
||||
|
||||
type NfsExportConf struct {
|
||||
Path string `yaml:"path"`
|
||||
Options string `yaml:"options"`
|
||||
Mount bool `yaml:"mount"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
//TODO: Check to make sure nodes.conf is found
|
||||
if !util.IsFile(ConfigFile) {
|
||||
|
||||
Reference in New Issue
Block a user