ansible

package
v1.207.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecutePlaybook

func ExecutePlaybook(
	info *schema.ConfigAndStacksInfo,
	flags *Flags,
) error

ExecutePlaybook executes an Ansible playbook command.

func ExecuteVersion

func ExecuteVersion(info *schema.ConfigAndStacksInfo) error

ExecuteVersion executes the ansible version command.

func GetInventoryFromSettings

func GetInventoryFromSettings(settingsSection *schema.AtmosSectionMapType) (string, error)

GetInventoryFromSettings extracts the inventory from settings.ansible.inventory.

func GetPlaybookFromSettings

func GetPlaybookFromSettings(settingsSection *schema.AtmosSectionMapType) (string, error)

GetPlaybookFromSettings extracts the playbook from settings.ansible.playbook.

Types

type AnsibleComponentProvider

type AnsibleComponentProvider struct{}

AnsibleComponentProvider implements ComponentProvider for Ansible components. It wraps the existing Ansible execution logic in internal/exec/ansible.go and provides a registry-compatible interface for component operations.

func (*AnsibleComponentProvider) Execute

Execute runs a command for ansible components. Delegates to the appropriate executor function based on the subcommand.

func (*AnsibleComponentProvider) GenerateArtifacts

func (a *AnsibleComponentProvider) GenerateArtifacts(ctx *component.ExecutionContext) error

GenerateArtifacts creates necessary files for ansible component execution. For Ansible, this includes variable files passed via --extra-vars.

func (*AnsibleComponentProvider) GetAvailableCommands

func (a *AnsibleComponentProvider) GetAvailableCommands() []string

GetAvailableCommands returns list of commands this component type supports.

func (*AnsibleComponentProvider) GetBasePath

func (a *AnsibleComponentProvider) GetBasePath(atmosConfig *schema.AtmosConfiguration) string

GetBasePath returns the base directory path for this component type.

func (*AnsibleComponentProvider) GetGroup

func (a *AnsibleComponentProvider) GetGroup() string

GetGroup returns the component group for categorization.

func (*AnsibleComponentProvider) GetType

func (a *AnsibleComponentProvider) GetType() string

GetType returns the component type identifier.

func (*AnsibleComponentProvider) ListComponents

func (a *AnsibleComponentProvider) ListComponents(ctx context.Context, stack string, stackConfig map[string]any) ([]string, error)

ListComponents discovers all ansible components in a stack.

func (*AnsibleComponentProvider) ValidateComponent

func (a *AnsibleComponentProvider) ValidateComponent(config map[string]any) error

ValidateComponent validates ansible component configuration.

type CommandArgs

type CommandArgs struct {
	Command string
	Args    []string
}

CommandArgs holds the command and arguments for execution.

type Config

type Config struct {
	// BasePath is the logical path to ansible components (uses forward slashes on all platforms).
	// Filesystem path conversion happens during actual file operations.
	BasePath string `yaml:"base_path" json:"base_path" mapstructure:"base_path"`

	// Command is the ansible binary to use (default: ansible).
	Command string `yaml:"command" json:"command" mapstructure:"command"`

	// AutoGenerateFiles enables automatic generation of auxiliary configuration files
	// during Ansible operations when set to true.
	// Generated files are defined in the component's generate section.
	AutoGenerateFiles bool `yaml:"auto_generate_files" json:"auto_generate_files" mapstructure:"auto_generate_files"`
}

Config represents the configuration structure for ansible components. This configuration mirrors the schema.Ansible struct from pkg/schema/schema.go. and is used for type-safe configuration access within the provider.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration for ansible components.

type Flags

type Flags struct {
	// Playbook specifies the Ansible playbook file to run.
	// Can be set via --playbook/-p flag or settings.ansible.playbook in stack manifest.
	Playbook string

	// Inventory specifies the Ansible inventory source.
	// Can be set via --inventory/-i flag or settings.ansible.inventory in stack manifest.
	Inventory string
}

Flags represents Ansible command-line flags.

type PlaybookConfig

type PlaybookConfig struct {
	Playbook  string
	Inventory string
}

PlaybookConfig holds the resolved playbook and inventory configuration.

Jump to

Keyboard shortcuts

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