Dagger
Search

docker-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/andrewrothstein/docker-ansible@22835409639cf37d4c7ae2f643c093efee9dc955

Entrypoint

Return Type
DockerAnsible !
Example
dagger -m github.com/andrewrothstein/docker-ansible@22835409639cf37d4c7ae2f643c093efee9dc955 call \
func (m *MyModule) Example() *dagger.DockerAnsible  {
	return dag.
			DockerAnsible()
}
@function
def example() -> dagger.DockerAnsible:
	return (
		dag.docker_ansible()
	)
@func()
example(): DockerAnsible {
	return dag
		.dockerAnsible()
}

Types

DockerAnsible 🔗

build() 🔗

Return Type
[Container ! ] !
Arguments
NameTypeDefault ValueDescription
osString !-No description provided
osVerString !-No description provided
upstreamOrgString nullNo description provided
upstreamOsString nullNo description provided
upstreamOsVerString nullNo description provided
uvVersionString !"latest"No description provided
platformsString !"linux/amd64"No description provided
Example
dagger -m github.com/andrewrothstein/docker-ansible@22835409639cf37d4c7ae2f643c093efee9dc955 call \
 build --os string --os-ver string --uv-version string --platforms string
func (m *MyModule) Example(os string, osVer string, uvVersion string, platforms string) []*dagger.Container  {
	return dag.
			DockerAnsible().
			Build(os, osVer, uvVersion, platforms)
}
@function
def example(os: str, os_ver: str, uv_version: str, platforms: str) -> List[dagger.Container]:
	return (
		dag.docker_ansible()
		.build(os, os_ver, uv_version, platforms)
	)
@func()
example(os: string, osVer: string, uvVersion: string, platforms: string): Container[] {
	return dag
		.dockerAnsible()
		.build(os, osVer, uvVersion, platforms)
}

publish() 🔗

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
osString !-No description provided
osVerString !-No description provided
dockerhubUsernameString nullNo description provided
dockerhubPasswordSecret nullNo description provided
ghcrUsernameString nullNo description provided
ghcrPasswordSecret nullNo description provided
upstreamOrgString nullNo description provided
upstreamOsString nullNo description provided
upstreamOsVerString nullNo description provided
targetImageSemverString !"0.0.0"No description provided
uvVersionString !"latest"No description provided
dockerhubRegistryString !"docker.io"No description provided
dockerhubOrgString !"andrewrothstein"No description provided
dockerhubRepoString !"docker-ansible"No description provided
ghcrRegistryString !"ghcr.io"No description provided
ghcrOrgString !"andrewrothstein"No description provided
ghcrRepoString !"docker-ansible"No description provided
platformsString !"linux/amd64"No description provided
Example
dagger -m github.com/andrewrothstein/docker-ansible@22835409639cf37d4c7ae2f643c093efee9dc955 call \
 publish --os string --os-ver string --target-image-semver string --uv-version string --dockerhub-registry string --dockerhub-org string --dockerhub-repo string --ghcr-registry string --ghcr-org string --ghcr-repo string --platforms string
func (m *MyModule) Example(ctx context.Context, os string, osVer string, targetImageSemver string, uvVersion string, dockerhubRegistry string, dockerhubOrg string, dockerhubRepo string, ghcrRegistry string, ghcrOrg string, ghcrRepo string, platforms string) []string  {
	return dag.
			DockerAnsible().
			Publish(ctx, os, osVer, targetImageSemver, uvVersion, dockerhubRegistry, dockerhubOrg, dockerhubRepo, ghcrRegistry, ghcrOrg, ghcrRepo, platforms)
}
@function
async def example(os: str, os_ver: str, target_image_semver: str, uv_version: str, dockerhub_registry: str, dockerhub_org: str, dockerhub_repo: str, ghcr_registry: str, ghcr_org: str, ghcr_repo: str, platforms: str) -> List[str]:
	return await (
		dag.docker_ansible()
		.publish(os, os_ver, target_image_semver, uv_version, dockerhub_registry, dockerhub_org, dockerhub_repo, ghcr_registry, ghcr_org, ghcr_repo, platforms)
	)
@func()
async example(os: string, osVer: string, targetImageSemver: string, uvVersion: string, dockerhubRegistry: string, dockerhubOrg: string, dockerhubRepo: string, ghcrRegistry: string, ghcrOrg: string, ghcrRepo: string, platforms: string): Promise<string[]> {
	return dag
		.dockerAnsible()
		.publish(os, osVer, targetImageSemver, uvVersion, dockerhubRegistry, dockerhubOrg, dockerhubRepo, ghcrRegistry, ghcrOrg, ghcrRepo, platforms)
}

testRole() 🔗

Test an Ansible role using the pre-built docker-ansible base images.

Expects the role directory structure: - test.yml at the root (the test playbook) - meta/requirements.yml (optional Galaxy dependencies) - Standard Ansible role structure (tasks/, vars/, defaults/, etc.)

Args: role_dir: Directory containing the Ansible role to test os: Operating system (e.g., ubuntu, debian, alpine) os_ver: OS version (e.g., noble, bookworm, 3.20) upstream_org: Override upstream organization (for special cases like kali) upstream_os: Override upstream OS name upstream_os_ver: Override upstream OS version target_image_semver: Version of docker-ansible image to use (default: latest) dockerhub_registry: Docker Hub registry URL dockerhub_org: Docker Hub organization dockerhub_repo: Docker Hub repository name ghcr_registry: GitHub Container Registry URL ghcr_org: GHCR organization ghcr_repo: GHCR repository name use_ghcr: Use GHCR instead of Docker Hub for base image (default: True) platforms: Comma-separated list of platforms to test

Returns: List of containers with test results

Return Type
[Container ! ] !
Arguments
NameTypeDefault ValueDescription
roleDirDirectory !-A directory.
osString !-No description provided
osVerString !-No description provided
upstreamOrgString nullNo description provided
upstreamOsString nullNo description provided
upstreamOsVerString nullNo description provided
targetImageSemverString !"0.0.0"No description provided
dockerhubRegistryString !"docker.io"No description provided
dockerhubOrgString !"andrewrothstein"No description provided
dockerhubRepoString !"docker-ansible"No description provided
ghcrRegistryString !"ghcr.io"No description provided
ghcrOrgString !"andrewrothstein"No description provided
ghcrRepoString !"docker-ansible"No description provided
useGhcrBoolean !trueNo description provided
platformsString !"linux/amd64"No description provided
Example
dagger -m github.com/andrewrothstein/docker-ansible@22835409639cf37d4c7ae2f643c093efee9dc955 call \
 test-role --role-dir DIR_PATH --os string --os-ver string --target-image-semver string --dockerhub-registry string --dockerhub-org string --dockerhub-repo string --ghcr-registry string --ghcr-org string --ghcr-repo string --use-ghcr boolean --platforms string
func (m *MyModule) Example(roleDir *dagger.Directory, os string, osVer string, targetImageSemver string, dockerhubRegistry string, dockerhubOrg string, dockerhubRepo string, ghcrRegistry string, ghcrOrg string, ghcrRepo string, useGhcr bool, platforms string) []*dagger.Container  {
	return dag.
			DockerAnsible().
			TestRole(roleDir, os, osVer, targetImageSemver, dockerhubRegistry, dockerhubOrg, dockerhubRepo, ghcrRegistry, ghcrOrg, ghcrRepo, useGhcr, platforms)
}
@function
def example(role_dir: dagger.Directory, os: str, os_ver: str, target_image_semver: str, dockerhub_registry: str, dockerhub_org: str, dockerhub_repo: str, ghcr_registry: str, ghcr_org: str, ghcr_repo: str, use_ghcr: bool, platforms: str) -> List[dagger.Container]:
	return (
		dag.docker_ansible()
		.test_role(role_dir, os, os_ver, target_image_semver, dockerhub_registry, dockerhub_org, dockerhub_repo, ghcr_registry, ghcr_org, ghcr_repo, use_ghcr, platforms)
	)
@func()
example(roleDir: Directory, os: string, osVer: string, targetImageSemver: string, dockerhubRegistry: string, dockerhubOrg: string, dockerhubRepo: string, ghcrRegistry: string, ghcrOrg: string, ghcrRepo: string, useGhcr: boolean, platforms: string): Container[] {
	return dag
		.dockerAnsible()
		.testRole(roleDir, os, osVer, targetImageSemver, dockerhubRegistry, dockerhubOrg, dockerhubRepo, ghcrRegistry, ghcrOrg, ghcrRepo, useGhcr, platforms)
}