Documentation ¶
Index ¶
- Constants
- func ClientKeyAuth(keyFile string) (ssh.AuthMethod, error)
- func PasswordAuth(pass string) (ssh.AuthMethod, error)
- func UpdateTasks(tasksPtr *[]Task, vars TaskVars, ndx int, machine Machine) error
- type LocalTransport
- type Machine
- type Plan
- type RegisterOutput
- type SSHTransport
- type Task
- type TaskStatus
- type TaskVars
- type TransportConfig
- type TransportInterface
Constants ¶
const ( ECHO = 53 TTY_OP_ISPEED = 128 TTY_OP_OSPEED = 129 )
Variables ¶
This section is empty.
Functions ¶
func ClientKeyAuth ¶
func ClientKeyAuth(keyFile string) (ssh.AuthMethod, error)
func PasswordAuth ¶
func PasswordAuth(pass string) (ssh.AuthMethod, error)
Types ¶
type LocalTransport ¶
type LocalTransport struct{}
func NewLocal ¶
func NewLocal(config *TransportConfig) (*LocalTransport, error)
func (*LocalTransport) Exec ¶
func (localTransport *LocalTransport) Exec(action string) (*bytes.Buffer, error)
func (*LocalTransport) Initialize ¶
func (localTransport *LocalTransport) Initialize(config *TransportConfig) error
type Machine ¶
type Machine struct { Hostname string Transport TransportInterface }
type Plan ¶
type Plan struct { Hosts []string Tasks []Task `yaml:"tasks"` Vars TaskVars Name string // contains filtered or unexported fields }
A plan is a collection of tasks. All the tasks are executed serially, although the same plan is run concurrently on multiple machines
func NewPlanFromYAML ¶
Returns a new plan with a collection of tasks. The planBuf and hostsFileBuf should be a valid 'yaml' representation. Additionally, this function also takes in any variable overrides that takes precedence over the variables present in the plan.
func (*Plan) PrintReport ¶
func (plan *Plan) PrintReport()
Prints the summary of the Plan execution across all the hosts
func (*Plan) SaveStatus ¶
Mark a given task's status. NOTE: Skipped tasks are not tracked here.
type RegisterOutput ¶
type SSHTransport ¶
type SSHTransport struct { Host string Port uint16 Config *ssh.ClientConfig }
func NewSSH ¶
func NewSSH(config *TransportConfig) (*SSHTransport, error)
func (*SSHTransport) Exec ¶
func (sshTransport *SSHTransport) Exec(action string) (*bytes.Buffer, error)
func (*SSHTransport) Initialize ¶
func (sshTransport *SSHTransport) Initialize(config *TransportConfig) error
type Task ¶
type Task struct { Id string Name string Action string Register string Include string When string Vars TaskVars IgnoreErrors bool `yaml:"ignore_errors"` LocalAction bool `yaml:"local"` }
Task is the unit of work in henchman.
func PrepareTasks ¶
change this to be a non-plan function come back to context variable stuff after getting include done look at diagram renders Task list, uses vars and machine for context
func (*Task) ProcessWhen ¶
Processes When param of a task. Evaluates it using pongo2 and uses a registerMap (populated by other tasks register variables) as the context
func (*Task) Run ¶
func (task *Task) Run(machine *Machine, regMap map[string]interface{}) (*TaskStatus, error)
func prepareTemplate(data string, vars *TaskVars, machine *Machine) (string, error) { tmpl, err := pongo2.FromString(data) if err != nil { panic(err) } ctxt := pongo2.Context{"vars": vars, "machine": machine} return tmpl.Execute(ctxt) }
// Renders the template parts in the task field. // Also assigns a new UUID to the task uniquely identifying it.
func (task *Task) prepare(vars *TaskVars, machine *Machine) { var err error task.Id = uuid.New() task.Name, err = prepareTemplate(task.Name, vars, machine) if err != nil { panic(err) } task.Action, err = prepareTemplate(task.Action, vars, machine) if err != nil { panic(err) } }
Runs the task on the machine. The task might mutate `vars` so that other tasks down the `plan` can see any additions/updates.