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@0b025304ae0c0e62329858628feb470e3487d6a2

Entrypoint

Return Type
Ansible !
Example
dagger -m github.com/abes140377/homelab-daggerverse/ansible@0b025304ae0c0e62329858628feb470e3487d6a2 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 🔗

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@0b025304ae0c0e62329858628feb470e3487d6a2 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@0b025304ae0c0e62329858628feb470e3487d6a2 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)
}