Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunNodeInstallCmd

func RunNodeInstallCmd(option NodeInstallOption) (err error)

RunNodeInstallCmd install node

func WriteHostsFile

func WriteHostsFile(filePath, installConfPath string, hosts []*client.HostNode) error

WriteHostsFile write hosts file

Types

type Host

type Host struct {
	AnsibleHostIP net.IP
	//ssh port
	AnsibleHostPort          int
	HostID                   string
	Role                     client.HostRule
	CreateTime               time.Time
	AnsibleSSHPrivateKeyFile string
}

Host ansible host config

func (*Host) String

func (a *Host) String() string

String reutrn Host string

type HostConfig

type HostConfig struct {
	FileName  string
	GroupList map[string]*HostGroup
}

HostConfig ansible hosts config

func GetAnsibleHostConfig

func GetAnsibleHostConfig(name string) *HostConfig

GetAnsibleHostConfig get config

func (*HostConfig) AddHost

func (c *HostConfig) AddHost(h *client.HostNode, installConfPath string)

AddHost add host

func (*HostConfig) Content

func (c *HostConfig) Content() string

Content return config file content

func (*HostConfig) ContentBuffer

func (c *HostConfig) ContentBuffer() *bytes.Buffer

ContentBuffer content buffer

func (*HostConfig) WriteFile

func (c *HostConfig) WriteFile() error

WriteFile write config file

type HostGroup

type HostGroup struct {
	Name     string
	HostList HostsList
}

HostGroup ansible host group config

func (*HostGroup) AddHost

func (a *HostGroup) AddHost(h *Host)

AddHost add host

func (*HostGroup) String

func (a *HostGroup) String() string

String return HostList string

type HostsList

type HostsList []*Host

HostsList hosts list

func (HostsList) Len

func (list HostsList) Len() int

func (HostsList) Less

func (list HostsList) Less(i, j int) bool

func (HostsList) Swap

func (list HostsList) Swap(i, j int)

type NodeInstallOption

type NodeInstallOption struct {
	HostRole   string
	HostName   string
	InternalIP string
	RootPass   string // ssh login password
	KeyPath    string // ssh login key path
	NodeID     string
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
	// contains filtered or unexported fields
}

NodeInstallOption node install option

Source Files