Documentation
¶
Overview ¶
* @Author: 0xe8998e@gmail.com * @Date: 2022-01-01 00:22:03 * @LastEditTime: 2022-02-07 20:34:40 * @LastEditors: 0xe8998e@gmail.com * @FilePath: /gosible/pkg/gosible/gosible.go * @Description: gosible Contol Servers of DevOps's Tool
* @Author: 0xe8998e@gmail.com * @Date: 2022-01-01 00:22:03 * @LastEditTime: 2022-01-28 16:44:06 * @LastEditors: 0xe8998e@gmail.com * @FilePath: /gosible/pkg/gosible/gosible.go * @Description: gosible Contol Servers of DevOps's Tool
* @Author: 0xe8998e@gmail.com * @Date: 2021-09-29 17:08:32 * @LastEditTime: 2022-01-28 16:49:25 * @LastEditors: 0xe8998e@gmail.com * @FilePath: /gosible/pkg/gosible/param.go * @Description: gosible Contol Servers of DevOps's Tool
* @Author: 0xe8998e@gmail.com * @Date: 2022-01-01 00:22:03 * @LastEditTime: 2022-01-28 16:51:12 * @LastEditors: 0xe8998e@gmail.com * @FilePath: /gosible/pkg/gosible/playbook.go * @Description: gosible Contol Servers of DevOps's Tool
* @Author: 0xe8998e@gmail.com * @Date: 2022-01-01 00:22:03 * @LastEditTime: 2022-01-28 20:43:30 * @LastEditors: 0xe8998e@gmail.com * @FilePath: /gosible/pkg/gosible/result.go * @Description: gosible Contol Servers of DevOps's Tool
* @Author: 0xe8998e@gmail.com * @Date: 2022-01-01 00:22:03 * @LastEditTime: 2022-01-28 16:44:06 * @LastEditors: 0xe8998e@gmail.com * @FilePath: /gosible/pkg/gosible/gosible.go * @Description: gosible Contol Servers of DevOps's Tool
* @Author: 0xe8998e@gmail.com * @Date: 2022-01-01 00:22:03 * @LastEditTime: 2022-01-28 22:17:00 * @LastEditors: 0xe8998e@gmail.com * @FilePath: /gosible/pkg/gosible/task.go * @Description: gosible Contol Servers of DevOps's Tool
* @Author: 0xe8998e@gmail.com * @Date: 2022-01-01 00:22:03 * @LastEditTime: 2022-01-28 23:01:27 * @LastEditors: 0xe8998e@gmail.com * @FilePath: /gosible/pkg/gosible/tasks.go * @Description: gosible Contol Servers of DevOps's Tool
* @Author: 0xe8998e@gmail.com * @Date: 2022-01-01 00:22:03 * @LastEditTime: 2022-02-07 20:54:17 * @LastEditors: 0xe8998e@gmail.com * @FilePath: /gosible/gosible/utils.go * @Description: gosible Contol Servers of DevOps's Tool
* @Author: 0xe8998e@gmail.com * @Date: 2021-09-29 17:08:32 * @LastEditTime: 2022-01-28 16:46:38 * @LastEditors: 0xe8998e@gmail.com * @FilePath: /gosible/pkg/gosible/vars.go * @Description: gosible Contol Servers of DevOps's Tool
Index ¶
- Constants
- func CSTLayoutString() string
- func DPanic(args ...interface{})
- func DPanicf(template string, args ...interface{})
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func GetProjectAbsPath(filename string) (projectAbsPath string)
- func InStringSlice(haystack []string, needle string) bool
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func InitLogger()
- func Panic(args ...interface{})
- func Panicf(template string, args ...interface{})
- func TemplateFile(template string, varsMap map[string]interface{}) (string, error)
- func TemplateString(template string, varsMap map[string]interface{}) (string, error)
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- type CopyParam
- type Executer
- func (executer *Executer) Copy(task Task) (HostResult, error)
- func (executer *Executer) Run(task Task) (HostResult, error)
- func (executer *Executer) Shell(task Task) (HostResult, error)
- func (executer *Executer) Template(task Task) (HostResult, error)
- func (executer *Executer) YumRepository(task Task) (HostResult, error)
- type ExecuterParam
- type ExecuterResult
- type Gosible
- type Group
- type Groups
- type Host
- type HostResult
- type Inventory
- type Param
- type PlayBook
- type PlayBookAfterActionFunc
- type PlayBookBeforeActionFunc
- type PlayBookResult
- type PlayBooks
- func (playBooks *PlayBooks) Append(data PlayBook) *PlayBooks
- func (playBooks *PlayBooks) ParseInventory(configName string) error
- func (playBooks *PlayBooks) ParsePlayBooks(configName string) (*PlayBooks, error)
- func (playBooks *PlayBooks) Run() (PlayBooksResult, error)
- func (playBooks *PlayBooks) SetAfterAction(afterAction PlayBooksAfterActionFunc) bool
- func (playBooks *PlayBooks) SetBeforeAction(beforeAction PlayBooksBeforeActionFunc) bool
- func (playBooks *PlayBooks) Sort() *PlayBooks
- type PlayBooksAfterActionFunc
- type PlayBooksBeforeActionFunc
- type PlayBooksResult
- type Role
- type Roles
- type ShellParam
- type SortPlayBooks
- type SortTasks
- type Task
- type TaskAfterActionFunc
- type TaskBeforeActionFunc
- type TaskResult
- type Tasks
- type TemplateParam
- type Vars
- type YumRepositoryParam
Constants ¶
const ( FAILED = "failed" SUCESSFUL = "sucessful" )
Variables ¶
This section is empty.
Functions ¶
func CSTLayoutString ¶
func CSTLayoutString() string
func GetProjectAbsPath ¶
func InStringSlice ¶
func InitLogger ¶
func InitLogger()
func TemplateFile ¶
func TemplateString ¶
Types ¶
type Executer ¶
func (*Executer) Shell ¶
func (executer *Executer) Shell(task Task) (HostResult, error)
*
- @description:
- @param {Task} task
- @return HostResult{},error
func (*Executer) YumRepository ¶
func (executer *Executer) YumRepository(task Task) (HostResult, error)
type ExecuterParam ¶
type ExecuterResult ¶
type ExecuterResult struct {
HostResult HostResult
Error error
}
type Gosible ¶
type Gosible struct {
Inventory string `yaml:"inventory" default:"hosts"`
PlayBooks string `yaml:"playbooks" default:"playbooks.yml"`
}
Define Gosible Struct As Entry
type Group ¶
func GetHostsByGroupName ¶
*
- @description:
- @param {Inventory} inventory
- @param {string} groupName
- @return {*}
type HostResult ¶
type Inventory ¶
type Inventory struct {
Groups Groups `yaml:"groups"`
}
func ParseInventory ¶
*
- @description: Parse Invenory File Return Inventory
- @param {string} configName
- @return {*}
type PlayBook ¶
type PlayBook struct {
Name string `yaml:"name"`
Priority int `yaml:"priority"`
GroupName string `yaml:"groupName"`
Group Group `yaml:"group"`
Vars map[string]string `yaml:"vars"`
Roles Roles `yaml:"roles"`
StartDateTime string
EndDateTime string
BeforeAction []PlayBookBeforeActionFunc
AfterAction []PlayBookAfterActionFunc
}
func (*PlayBook) SetAfterAction ¶
func (playBook *PlayBook) SetAfterAction(afterAction PlayBookAfterActionFunc) bool
func (*PlayBook) SetBeforeAction ¶
func (playBook *PlayBook) SetBeforeAction(beforeAction PlayBookBeforeActionFunc) bool
type PlayBookAfterActionFunc ¶
type PlayBookResult ¶
type PlayBookResult struct {
Name string `json:"name"`
TaskResults []TaskResult `json:"task_results"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
}
type PlayBooks ¶
type PlayBooks struct {
Inventory Inventory
PlayBooks []PlayBook `yaml:"playbooks"`
BeforeAction []PlayBooksBeforeActionFunc
AfterAction []PlayBooksAfterActionFunc
}
func (*PlayBooks) ParseInventory ¶
func (*PlayBooks) ParsePlayBooks ¶
func (*PlayBooks) Run ¶
func (playBooks *PlayBooks) Run() (PlayBooksResult, error)
func (*PlayBooks) SetAfterAction ¶
func (playBooks *PlayBooks) SetAfterAction(afterAction PlayBooksAfterActionFunc) bool
func (*PlayBooks) SetBeforeAction ¶
func (playBooks *PlayBooks) SetBeforeAction(beforeAction PlayBooksBeforeActionFunc) bool
type PlayBooksResult ¶
type PlayBooksResult struct {
PlayBookResults []PlayBookResult `json:"playbooks"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
}
type ShellParam ¶
type ShellParam struct {
Data string
}
type SortPlayBooks ¶
func (SortPlayBooks) Len ¶
func (pw SortPlayBooks) Len() int
func (SortPlayBooks) Less ¶
func (pw SortPlayBooks) Less(i, j int) bool
func (SortPlayBooks) Swap ¶
func (pw SortPlayBooks) Swap(i, j int)
type Task ¶
type Task struct {
Id string
Name string
Cmd string
FileName string
Tag string
Vars Vars
Param Param
Priority int
StartDateTime string
EndDateTime string
BeforeAction []TaskBeforeActionFunc
AfterAction []TaskAfterActionFunc
}
func (*Task) SetAfterAction ¶
func (task *Task) SetAfterAction(afterAction TaskAfterActionFunc) bool
func (*Task) SetBeforeAction ¶
func (task *Task) SetBeforeAction(beforeAction TaskBeforeActionFunc) bool
type TaskAfterActionFunc ¶
type TaskBeforeActionFunc ¶
type TaskResult ¶
type TaskResult struct {
Name string `json:"name"`
HostResults []HostResult `json:"host_results"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
}
type Tasks ¶
type Tasks struct {
Tasks []Task `yaml:"tasks"`
}