Documentation ¶
Index ¶
- Constants
- type Executor
- type Job
- type JobOpts
- func WithAnsibleOpts(opts *playbook.AnsiblePlaybookOptions) JobOpts
- func WithExtraVars(key string, value interface{}) JobOpts
- func WithLimit(limit string) JobOpts
- func WithLogPath(logPath string) JobOpts
- func WithName(name string) JobOpts
- func WithPlaybook(playbook string) JobOpts
- func WithStderr(w io.Writer) JobOpts
- func WithStdout(w io.Writer) JobOpts
- func WithTags(tags ...string) JobOpts
Constants ¶
const ( JOB_READY = "ready" JOB_RUNNING = "running" JOB_FAILED = "failed" JOB_SUCCESS = "success" )
*************************************************************\ * Const * \*************************************************************
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor struct { WorkDir string Inventory string Config *conf.Config Jobs map[string]*Job Lock *sync.Mutex }
*************************************************************\ * Executor * \************************************************************* Executor hold config path and content
func NewExecutor ¶
NewExecutor will create ansible playbook executor based on config path
type Job ¶
type Job struct { ID string `json:"id"` // uuid v1 Name string `json:"name"` // human readable job info Playbook string `json:"playbook"` // playbook name Limit string `json:"limit"` // limit execution targets Tags []string `json:"tags"` // execution tags LogPath string `json:"log_path"` // write playbook log to ANSIBLE_LOG_PATH Status string `json:"status"` // ready | running | failed | success StartAt time.Time `json:"start_at"` // job start at DoneAt time.Time `json:"done_at"` // job done at Command string `json:"command"` // job raw shell command CMD *playbook.AnsiblePlaybookCmd `json:"-"` // ansible command Opts *playbook.AnsiblePlaybookOptions `json:"-"` // playbook options Exec *Executor `json:"-"` // Executor Stdout io.Writer `json:"-"` // write output to this Stderr io.Writer `json:"-"` // write error to this // contains filtered or unexported fields }
*************************************************************\ * Job * \************************************************************* Job is spawned by executor
type JobOpts ¶
type JobOpts func(*Job)
JobOpts will configure job
func WithAnsibleOpts ¶
func WithAnsibleOpts(opts *playbook.AnsiblePlaybookOptions) JobOpts
WithAnsibleOpts will overwrite entire options, use with caution!
func WithExtraVars ¶
WithExtraVars will add extra k-v into playbook's extra vars