pxeserver

package module
v0.0.0-...-a4ab83d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2022 License: GPL-2.0 Imports: 27 Imported by: 0

README

PXEServer

A server to manage network booting of machines via PXE. Built on the fantastic Pixiecore project with added features such as file templating and writing raw images to disk over the network.

WORK IN PROGRESS

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigBooter

func ConfigBooter(cfg Pixiecore, files Files) (pixiecore.Booter, error)

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(configReader io.Reader) (Config, error)

func (*Config) Files

func (c *Config) Files() []File

func (*Config) Pixiecore

func (c *Config) Pixiecore() Pixiecore

func (*Config) SecretDefs

func (c *Config) SecretDefs() map[string][]SecretDef

func (*Config) VarsForHost

func (c *Config) VarsForHost(mac string) (map[string]interface{}, error)

type File

type File struct {
	Mac          string
	Path         string
	URL          string
	SHA256       string
	ID           string
	Template     bool
	Vars         map[string]interface{}
	ImageConvert ImageConvert `json:"image_convert"`
	Gzip         bool
}

type Files

type Files struct {
	// contains filtered or unexported fields
}

func LoadFiles

func LoadFiles(files []File, renderer renderer) (Files, error)

func (Files) MD5

func (f Files) MD5(id string) (string, error)

func (Files) Read

func (f Files) Read(id string) (io.ReadCloser, int64, error)

func (Files) SHA256

func (f Files) SHA256(id string) (string, error)

type Host

type Host struct {
	Mac           string
	Kernel        File
	Initrds       []File
	Files         []File
	BootArgs      []string `json:"boot_args"`
	Vars          map[string]interface{}
	Secrets       []SecretDef
	ForcePXELinux bool `json:"force_pxe_linux"`
}

type ImageConvert

type ImageConvert struct {
	InputFormat string `json:"input_format"`
}

type MacAddress

type MacAddress string

type MachineConfig

type MachineConfig struct {
	Kernel        string
	Initrd        []string
	Cmdline       string
	ForcePXELinux bool
}

type Pixiecore

type Pixiecore map[MacAddress]MachineConfig

type RenderCmdlineArgs

type RenderCmdlineArgs struct {
	Template   string
	Mac        string
	Vars       map[string]interface{}
	ExtraFuncs template.FuncMap
	Files      fileHelper
}

type RenderFileArgs

type RenderFileArgs struct {
	Mac      string
	Template string
	Vars     map[string]interface{}
}

type Renderer

type Renderer struct {
	Secrets Secrets
}

func (Renderer) RenderCmdline

func (r Renderer) RenderCmdline(args RenderCmdlineArgs) (string, error)

func (Renderer) RenderFile

func (r Renderer) RenderFile(args RenderFileArgs) (string, error)

func (Renderer) RenderPath

func (r Renderer) RenderPath(filepath string) (string, error)

type SecretDef

type SecretDef struct {
	ID   string
	Type string
	Opts map[string]interface{}
}

type Secrets

type Secrets interface {
	GetOrGenerate(mac string, id string) (interface{}, error)
	Get(mac string, id string) (interface{}, error)
	GetField(mac string, id string, field string) (interface{}, error)
}

func LoadLocalSecrets

func LoadLocalSecrets(storePath string, hostToDefs map[string][]SecretDef) (Secrets, error)

type Server

type Server struct {
	Config      io.Reader
	Address     string
	LogFunc     func(subsys, msg string)
	DHCPNoBind  bool
	SecretsPath string
}

func (Server) Serve

func (s Server) Serve() error

type ServerConfig

type ServerConfig struct {
	Hosts         []Host
	Vars          map[string]interface{}
	SharedSecrets []SecretDef `json:"shared_secrets"`
}

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL