Dagger
Search

ansible

This module has been generated via dagger init and serves as a reference to
basic module structure as you get started with Dagger.

Two functions have been pre-created. You can modify, delete, or add to them,
as needed. They demonstrate usage of arguments and return types using simple
echo and grep commands. The functions can be called from the dagger CLI or
from one of the SDKs.

The first line in this comment block is a short description line and the
rest is a long description with more detail on the module's purpose or usage,
if appropriate. All modules should have a short description.

Installation

dagger install github.com/abes140377/homelab-daggerverse/ansible@cb7f690f46d6d0dc7594aac7b91f54701100b8ac

Entrypoint

Return Type
Ansible !
Example
dagger -m github.com/abes140377/homelab-daggerverse/ansible@cb7f690f46d6d0dc7594aac7b91f54701100b8ac call \
func (m *MyModule) Example() *dagger.Ansible  {
	return dag.
			Ansible()
}
@function
def example() -> dagger.Ansible:
	return (
		dag.ansible()
	)
@func()
example(): Ansible {
	return dag
		.ansible()
}

Types

Ansible 🔗

debugContainer() 🔗

Return an interactive container for debugging and testing.

Args: directory: Directory containing the Ansible playbook ssh_private_key: SSH private key for SSH connections (optional)

Returns: A container with shell access for interactive debugging

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
directoryDirectory !-A directory.
sshPrivateKeySecret nullNo description provided
Example
dagger -m github.com/abes140377/homelab-daggerverse/ansible@cb7f690f46d6d0dc7594aac7b91f54701100b8ac call \
 debug-container --directory DIR_PATH
func (m *MyModule) Example(directory *dagger.Directory) *dagger.Container  {
	return dag.
			Ansible().
			DebugContainer(directory)
}
@function
def example(directory: dagger.Directory) -> dagger.Container:
	return (
		dag.ansible()
		.debug_container(directory)
	)
@func()
example(directory: Directory): Container {
	return dag
		.ansible()
		.debugContainer(directory)
}

galaxyInstall() 🔗

Install Ansible Galaxy collections from a requirements file.

Args: directory: Directory containing the Ansible playbook and requirements file requirements_file: Path to the requirements file (default: requirements.yml)

Returns: A container with the collections installed

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
directoryDirectory !-A directory.
requirementsFileString !"requirements.yml"No description provided
Example
dagger -m github.com/abes140377/homelab-daggerverse/ansible@cb7f690f46d6d0dc7594aac7b91f54701100b8ac call \
 galaxy-install --directory DIR_PATH --requirements-file string
func (m *MyModule) Example(directory *dagger.Directory, requirementsFile string) *dagger.Container  {
	return dag.
			Ansible().
			GalaxyInstall(directory, requirementsFile)
}
@function
def example(directory: dagger.Directory, requirements_file: str) -> dagger.Container:
	return (
		dag.ansible()
		.galaxy_install(directory, requirements_file)
	)
@func()
example(directory: Directory, requirementsFile: string): Container {
	return dag
		.ansible()
		.galaxyInstall(directory, requirementsFile)
}

runPlaybook() 🔗

Execute an Ansible playbook with optional parameters.

Args: directory: Directory containing the Ansible playbook playbook: Path to the playbook file (relative to directory) inventory: Path to inventory file (optional) extra_vars: List of extra variables in key=value format (optional) tags: List of tags to filter tasks (optional) ssh_private_key: SSH private key for SSH connections (optional)

Returns: The stdout output from the playbook execution

Return Type
String !
Arguments
NameTypeDefault ValueDescription
directoryDirectory !-A directory.
playbookString !-No description provided
inventoryString !""No description provided
extraVars[String ! ] nullNo description provided
tags[String ! ] nullNo description provided
sshPrivateKeySecret nullNo description provided
Example
dagger -m github.com/abes140377/homelab-daggerverse/ansible@cb7f690f46d6d0dc7594aac7b91f54701100b8ac call \
 run-playbook --directory DIR_PATH --playbook string --inventory string
func (m *MyModule) Example(ctx context.Context, directory *dagger.Directory, playbook string, inventory string) string  {
	return dag.
			Ansible().
			RunPlaybook(ctx, directory, playbook, inventory)
}
@function
async def example(directory: dagger.Directory, playbook: str, inventory: str) -> str:
	return await (
		dag.ansible()
		.run_playbook(directory, playbook, inventory)
	)
@func()
async example(directory: Directory, playbook: string, inventory: string): Promise<string> {
	return dag
		.ansible()
		.runPlaybook(directory, playbook, inventory)
}