ansible
This module has been generated via dagger init and serves as a reference tobasic 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@942224240395bebf8b0ee418b2d5b70589ebb551Entrypoint
Return Type
Ansible !Example
dagger -m github.com/abes140377/homelab-daggerverse/ansible@942224240395bebf8b0ee418b2d5b70589ebb551 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
| Name | Type | Default Value | Description | 
|---|---|---|---|
| directory | Directory ! | - | A directory. | 
| requirementsFile | String ! | "requirements.yml" | No description provided | 
Example
dagger -m github.com/abes140377/homelab-daggerverse/ansible@942224240395bebf8b0ee418b2d5b70589ebb551 call \
 galaxy-install --directory DIR_PATH --requirements-file stringfunc (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
| Name | Type | Default Value | Description | 
|---|---|---|---|
| directory | Directory ! | - | A directory. | 
| playbook | String ! | - | No description provided | 
| inventory | String ! | "" | No description provided | 
| extraVars | [String ! ] | null | No description provided | 
| tags | [String ! ] | null | No description provided | 
| sshPrivateKey | Secret | null | No description provided | 
| requirementsFile | String ! | "" | No description provided | 
Example
dagger -m github.com/abes140377/homelab-daggerverse/ansible@942224240395bebf8b0ee418b2d5b70589ebb551 call \
 run-playbook --directory DIR_PATH --playbook string --inventory string --requirements-file stringfunc (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)
}