config

package
v0.0.0-...-772fc7e Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Spec    Spec    `yaml:"spec" json:"spec"`
	Gosible Gosible `yaml:"gosible" json:"gosible"`
}

func NewConfig

func NewConfig() *Config

func (*Config) ReadInConfig

func (c *Config) ReadInConfig(cfgPath string) error

type Gosible

type Gosible struct {
	Tasks []Task `yaml:"tasks" json:"tasks" valid:"required"`
}

type HostCfg

type HostCfg struct {
	Name            string `yaml:"name,omitempty" json:"name,omitempty" valid:"required"`
	Address         string `yaml:"address,omitempty" json:"address,omitempty" valid:"required"`
	InternalAddress string `yaml:"internalAddress,omitempty" json:"internalAddress,omitempty"`
	Port            int    `yaml:"port,omitempty" json:"port,omitempty" default:"22"`
	User            string `yaml:"user,omitempty" json:"user,omitempty" valid:"required"`
	Password        string `yaml:"password,omitempty" json:"password,omitempty" valid:"required"`
	PrivateKey      string `yaml:"privateKey,omitempty" json:"privateKey,omitempty"`
	PrivateKeyPath  string `yaml:"privateKeyPath,omitempty" json:"privateKeyPath,omitempty"`
	Arch            string `yaml:"arch,omitempty" json:"arch,omitempty" default:"amd64"`

	Labels   map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`
	ID       string            `yaml:"id,omitempty" json:"id,omitempty"`
	Index    int               `json:"-"`
	IsEtcd   bool              `json:"-"`
	IsMaster bool              `json:"-"`
	IsWorker bool              `json:"-"`

	EtcdExist bool   `json:"-"`
	EtcdName  string `json:"-"`
}

type Options

type Options struct {
	Verbose  bool   // 是否开启debug
	CfgPath  string // 配置文件路径
	Parallel bool   // 是否并行执行任务
	Retries  int    // 命令执行失败重试次数
	TimeOut  int    // 命令执行超时时间
}

type Spec

type Spec struct {
	Hosts []HostCfg `yaml:"hosts" json:"hosts" valid:"required"`
}

type Task

type Task struct {
	Type string `yaml:"type" json:"type" valid:"in(ssh|scp)"` // ssh/sftp
	Src  string `yaml:"src" json:"src"`
	Dst  string `yaml:"dst" json:"dst"`
	Cmd  string `yaml:"cmd" json:"cmd"`
}

Jump to

Keyboard shortcuts

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