plugin

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: GPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRunPlugin

func CheckRunPlugin(PluginName string, ID string) error

CheckRunPlugin Checks if the ID belongs to the group or container calls the plugin function the appropriate amount of times

func DeletePlugin

func DeletePlugin(pluginname string) error

DeletePlugin The following function deletes a plugin based on the plugin name provided.

func DownloadPlugin

func DownloadPlugin(pluginurl string) error

DownloadPlugin This functions downloads package from a git repo.

func RunPluginContainer

func RunPluginContainer(PluginName string, ContainerID string) error

RunPluginContainer Runs ansible plugin based on plugin name and container name which is derived from the tracked containers file We pass in the group ID as a parameter because when we modify the ports taken

Types

type ExecuteIP

type ExecuteIP struct {
	ContainerID string
	IPAddress   string
	SSHPortNo   string
	Success     bool
}

ExecuteIP IP Address to execute Ansible instruction

func (*ExecuteIP) ModifyHost

func (e *ExecuteIP) ModifyHost(p *Plugin) error

ModifyHost adds IP address , port no to the config file

func (*ExecuteIP) RunAnsible

func (e *ExecuteIP) RunAnsible(p *Plugin) error

RunAnsible Executes based on credentials on the struct

type Host

type Host struct {
	All struct {
		Vars struct {
			AnsiblePythonInterpreter string `yaml:"ansible_python_interpreter"`
		} `yaml:"vars"`
	} `yaml:"all"`
	Main struct {
		Hosts struct {
			Host1 struct {
				AnsibleHost     string `yaml:"ansible_host"`
				AnsiblePort     int    `yaml:"ansible_port"`
				AnsibleUser     string `yaml:"ansible_user"`
				AnsibleSSHPass  string `yaml:"ansible_ssh_pass"`
				AnsibleSudoPass string `yaml:"ansible_sudo_pass"`
			} `yaml:"host1"`
		} `yaml:"hosts"`
	} `yaml:"main"`
}

Host Struct for ansible host Generated from https://zhwt.github.io/yaml-to-go/

func ReadHost

func ReadHost(filename string) (*Host, error)

ReadHost Reads host file and adds

type Plugin

type Plugin struct {
	FolderName        string
	PluginDescription string

	Execute    []*ExecuteIP
	NumOfPorts int
	// contains filtered or unexported fields
}

Plugin Information about the plugins available

func RunPlugin

func RunPlugin(pluginName string, IPAddresses []*ExecuteIP) (*Plugin, error)

RunPlugin Executes plugins based on the plugin name provided

func SearchPlugin

func SearchPlugin(pluginname string) (*Plugin, error)

SearchPlugin Detects plugin information based on the name provided on the parameter

func (*Plugin) AutoSetPorts

func (p *Plugin) AutoSetPorts(containerID string) error

AutoSetPorts Automatically maps free ports to site.yml file

func (*Plugin) CopyToTmpPlugin

func (p *Plugin) CopyToTmpPlugin() error

CopyToTmpPlugin This function would ensure that we create a copy of the plugin in the tmp directory, and it would be executed from there. This due to the reason of automating port allocation when running plugins

func (*Plugin) ExecutePlugin

func (p *Plugin) ExecutePlugin() error

ExecutePlugin Function to execute plugins that are called

func (*Plugin) NumPorts

func (p *Plugin) NumPorts() error

NumPorts Gets the Number the ports the plugin requires

type Plugins

type Plugins struct {
	PluginsDetected []*Plugin
}

Plugins Array of all plugins detected

func DetectPlugins

func DetectPlugins() (*Plugins, error)

DetectPlugins Detects all the plugins available

Jump to

Keyboard shortcuts

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