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@c68b3febb5137e54351f4c84a70cd85e6b3d87fb

Entrypoint

Return Type
Ansible !
Example
dagger -m github.com/abes140377/homelab-daggerverse/ansible@c68b3febb5137e54351f4c84a70cd85e6b3d87fb 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@c68b3febb5137e54351f4c84a70cd85e6b3d87fb 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) requirements_file: Path to requirements file for galaxy collections (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
requirementsFileString !""No description provided
Example
dagger -m github.com/abes140377/homelab-daggerverse/ansible@c68b3febb5137e54351f4c84a70cd85e6b3d87fb call \
 run-playbook --directory DIR_PATH --playbook string --inventory string --requirements-file string
func (m *MyModule) Example(ctx context.Context, directory *dagger.Directory, playbook string, inventory string, requirementsFile string) string  {
	return dag.
			Ansible().
			RunPlaybook(ctx, directory, playbook, inventory, requirementsFile)
}
@function
async def example(directory: dagger.Directory, playbook: str, inventory: str, requirements_file: str) -> str:
	return await (
		dag.ansible()
		.run_playbook(directory, playbook, inventory, requirements_file)
	)
@func()
async example(directory: Directory, playbook: string, inventory: string, requirementsFile: string): Promise<string> {
	return dag
		.ansible()
		.runPlaybook(directory, playbook, inventory, requirementsFile)
}