Documentation ¶
Index ¶
- func ReturnedError(code int) error
- type BaseParam
- func (bp *BaseParam) AddBuffer(b Buffer)
- func (bp *BaseParam) AddInt(name string, i int)
- func (bp *BaseParam) AddInterface(name string, i interface{})
- func (bp *BaseParam) AddMap(m map[string]interface{})
- func (bp *BaseParam) AddNamedMap(name string, c map[string]interface{})
- func (bp *BaseParam) AddString(name string, s string)
- func (bp BaseParam) Content() (b []byte, e error)
- func (bp BaseParam) Copy() BaseParam
- type Buffer
- type EnvVars
- type ExtraVars
- type Manager
- type ParamValues
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReturnedError ¶
ReturnedError returns a error corresponding to the provided Ansible returned code.
Will return `nil` if the code is not an known Ansible error or if it's equal to `0`
Types ¶
type BaseParam ¶
type BaseParam struct { // The content of the BaseParam Body model.Parameters }
BaseParam contains the extra vars to be passed to a playbook
The BaseParam content is supposed to be serialized in yaml in order to be passed to a playbook
func BuildBaseParam ¶
func BuildBaseParam(env *model.Environment, pubK string, privK string, nodesetName string) BaseParam
BuildBaseParam the common parameters required by all playbooks.
Parameters:
name: the qualified name of the environment nodesetName: the name of the nodeset we are working with provider: the name of the provider where to create the nodeset pubK: the public SSH key to connect on the created nodeset ( the name of the file) privK: the private SSH key to connect on the created nodeset ( the name of the file)
func (*BaseParam) AddBuffer ¶
AddBuffer adds the parameters coming from the given buffer
Only the "Param" content of the buffer will be processed.
func (*BaseParam) AddInterface ¶
AddInterface adds a parameter of type interface{} for the given name
func (*BaseParam) AddNamedMap ¶
AddNamedMap adds a parameter of type map[string]interface{} for the given name
type Buffer ¶
type Buffer struct { // The environment variables to pass Envvars map[string]string // The extra vars to pass Extravars map[string]string // The inventories to pass Inventories map[string]string // The parameters to pass. // The parameters can be any valid yaml content Param map[string]interface{} }
Buffer contains the data to be passed from one playbook to another one
func GetBuffer ¶
GetBuffer returns a buffer based on the content of the given folder.
- The "Envvars" of the buffer will be filled by the content of the file name like EnvYamlFileName.
- The "Extravars" of the buffer will be filled by the content of the file name like ExtraVarYamlFileName.
- The "Inventories" of the buffer will be filled by the content of the file name like InventoryYamlFileName.
- The "Param" of the buffer will be filled by the content of the file name like ParamYamlFileName.
Parameters:
f: the folder where to look for the buffer content logger: the logger location: a string used to specify, into the log messages, to which concept the buffer is related
See Also :
EnvYamlFileName ExtraVarYamlFileName InventoryYamlFileName ParamYamlFileName
type EnvVars ¶
EnvVars contains the extra vars to be passed to a playbook
func (*EnvVars) Add ¶
Add adds the given key and value.
If the key already exists then its content will be overwritten by the by the value
func (*EnvVars) AddBuffer ¶
AddBuffer adds the environment variable coming from the given buffer
Only the "Extravars" content of the buffer will be processed.
If any of the buffered keys already exist then its content will be overwritten by the by the corresponding buffered value.
func (*EnvVars) AddDefaultOsVars ¶
func (ev *EnvVars) AddDefaultOsVars()
AddDefaultOsVars adds the HOSTNAME, PATH, TERM and HOME OS variables
type ExtraVars ¶
type ExtraVars struct { // Indicates if the struct has content or not Bool bool // The extra vars content Vals []string }
ExtraVars extra vars, received into the buffer, to be passed to a playbook
func BuildExtraVars ¶
func BuildExtraVars(extraVars string, inputFolder util.FolderPath, outputFolder util.FolderPath, b Buffer) ExtraVars
BuildExtraVars builds the extra var to pass to a playbook
type Manager ¶
type Manager interface { // Execute runs a playbook within a component // // Parameters: // cr: the component holding the playbook to launch // playbook: the name of the playbook to launch // extraVars: the extra vars passed to the playbook // envars: the environment variables set before launching the playbook // data: the template context required to template a used component // Execute(cr component.UsableComponent, playbook string, extraVars ExtraVars, envars EnvVars) (int, error) }
Manager executes an ansible playbook
func CreateAnsibleManager ¶
func CreateAnsibleManager(lC util.LaunchContext, componentManager component.Manager) Manager
CreateAnsibleManager returns a new AnsibleManager, able to launch playbook holded by the given component manager
type ParamValues ¶
func ParseParamValues ¶
func ParseParamValues(path string) (ParamValues, error)
ParseParamValues parses a yaml file into a map of "key:value" All the nested yaml levels will be concatenated to create the keys of the map.
As example :
level1: level2:value
Will generate the following key/value
level1.level2=value