Documentation ¶
Index ¶
- Constants
- type Host
- type Inventory
- type Module
- type Playbook
- func (pb *Playbook) CleanOnExit(b bool)
- func (pb *Playbook) Copy() *Playbook
- func (pb *Playbook) IsZero() bool
- func (pb *Playbook) OutputWriter(w io.Writer)
- func (pb *Playbook) Run(ctx context.Context) (err error)
- func (pb *Playbook) Runnable() bool
- func (pb *Playbook) Running() bool
- func (pb *Playbook) State() pbState
- func (pb *Playbook) String() string
- type Runnable
- type Session
- type SessionManager
Constants ¶
const (
PUBLIC_CLOUD_ANSIBLE_USER = "cloudroot"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Host ¶
type Host struct { // Name denotes the host to operate on Name string // Vars is a map recording host vars Vars map[string]string }
Host represents an ansible host
func ParseHostLine ¶
ParseHostLine parse string representation of an ansible host
Input should be in format "name key=value"
type Inventory ¶
type Inventory struct {
Hosts []Host
}
Inventory contains a list of ansible hosts
type Module ¶
type Module struct { // Name is ansible module name Name string // Args is a list of module arguments in form of key=value Args []string }
Module represents name and args of ansible module to execute
func ParseModuleLine ¶
ParseModuleLine parse string representation of an ansible module task
The input should be in format "name key=value arg0 arg1". The argN form is For module "command" and "shell"
type Playbook ¶
type Playbook struct { Inventory Inventory Modules []Module PrivateKey []byte Files map[string][]byte // contains filtered or unexported fields }
func NewPlaybook ¶
func NewPlaybook() *Playbook
func (*Playbook) CleanOnExit ¶
CleanOnExit decide whether temporary workdir will be cleaned up after Run
func (*Playbook) OutputWriter ¶
type Session ¶
type Session struct { // Ctx is the context under which the playbook will run Ctx context.Context // Runnable is the task to be run Runnable Runnable // contains filtered or unexported fields }
Session is a container for execution of playbook
type SessionManager ¶
SessionManager manages a collection of keyed sessions
func (SessionManager) Add ¶
func (sm SessionManager) Add(id string, runnable Runnable) *Session
Add adds a Runnable to the manager keyed with the specified id
func (SessionManager) Err ¶
func (sm SessionManager) Err(id string) error
Err returns possible error from sm.Ctx.Err()
func (SessionManager) Has ¶
func (sm SessionManager) Has(id string) bool
Has returns true if a session with the specified id exists in the manager
func (SessionManager) Remove ¶
func (sm SessionManager) Remove(id string)
Remove stops (if appliable) and removes the playbook keyed with the specified id from the manager
func (SessionManager) Run ¶
func (sm SessionManager) Run(id string) error
Run runs the playbook keyed with specified id
func (SessionManager) Stop ¶
func (sm SessionManager) Stop(id string)
Stop stops the playbook keyed with specified id