runner

package
v0.0.0-...-a51ba30 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunPlaybook = func(playbookFilePath string, globalConfig Config) error {
	logger.Info("Starting playbook run with %s", playbookFilePath)
	playbookSteps, err := parsePlaybook(playbookFilePath)
	if err != nil {
		logger.ErrorAndExit("Playbook has invalid syntax: %s", err)
	}
	roleList = playbookSteps.RoleList
	roleNames := []string{}
	for _, role := range roleList {
		roleNames = append(roleNames, role.Name)
	}
	logger.Debug("Available roles %s", strings.Join(roleNames, ", "))
	err = validateSteps(playbookSteps.StepList)
	if err != nil {
		logger.ErrorAndExit("Playbook is invalid: %s", err)
	}
	playbookPath, _ := filepath.Abs(filepath.Dir(playbookFilePath))
	globalStore := &store{
		config: globalConfig,
		path:   playbookPath,
	}
	for _, step := range playbookSteps.StepList {
		switch val := step.(type) {
		case steps.ServerStep:
			if err = handleServer(val, globalStore); err != nil {
				return err
			}
		case steps.InventoryStep:
			if err = handleInventory(val, globalStore); err != nil {
				return err
			}
		case steps.VariableStep:
			if err = handleVariable(val, globalStore); err != nil {
				return err
			}
		case steps.ContextContainer:
			if err = handleContainerContext(val, globalStore); err != nil {
				return err
			}
		case steps.InputStep:
			if err := handleInput(val, globalStore); err != nil {
				return err
			}
		}
	}
	return nil
}

RunPlaybook run playbook with given path and config

Functions

This section is empty.

Types

type Config

type Config struct {
	KeyFilePath string
	User        string
}

Config for azad

func (Config) SSHConfig

func (config Config) SSHConfig() conn.Config

SSHConfig extract config from main configuration

Jump to

Keyboard shortcuts

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