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

Entrypoint

Return Type
DockerAnsible !
Example
dagger -m github.com/andrewrothstein/docker-ansible@7df254dfd70341bbebecfd283001c6bc69697f5f 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@7df254dfd70341bbebecfd283001c6bc69697f5f 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@7df254dfd70341bbebecfd283001c6bc69697f5f 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 and publish to a registry.

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_name: Name of the role (used in published image name) 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) target_username: Username for target registry authentication target_password: Password/token for target registry authentication upstream_registry: Registry for base docker-ansible image (default: ghcr.io) upstream_org: Organization for base image (default: andrewrothstein) upstream_repo: Repository name for base image (default: docker-ansible) upstream_semver: Version of docker-ansible base image to use (default: 0.0.0) target_registry: Registry to publish tested containers (default: ghcr.io) target_org: Organization for published images (default: andrewrothstein) target_semver: Version tag for published images (default: 0.0.0) platforms: Comma-separated list of platforms to test (default: linux/amd64)

Returns: List of published image URLs

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
roleNameString !-No description provided
roleDirDirectory !-A directory.
osString !-No description provided
osVerString !-No description provided
targetUsernameString !-No description provided
targetPasswordSecret !-A reference to a secret value, which can be handled more safely than the value itself.
upstreamRegistryString !"ghcr.io"No description provided
upstreamOrgString !"andrewrothstein"No description provided
upstreamRepoString !"docker-ansible"No description provided
upstreamSemverString !"0.0.0"No description provided
targetRegistryString !"ghcr.io"No description provided
targetOrgString !"andrewrothstein"No description provided
targetSemverString !"0.0.0"No description provided
platformsString !"linux/amd64"No description provided
Example
dagger -m github.com/andrewrothstein/docker-ansible@7df254dfd70341bbebecfd283001c6bc69697f5f call \
 test-role --role-name string --role-dir DIR_PATH --os string --os-ver string --target-username string --target-password env:MYSECRET --upstream-registry string --upstream-org string --upstream-repo string --upstream-semver string --target-registry string --target-org string --target-semver string --platforms string
func (m *MyModule) Example(ctx context.Context, roleName string, roleDir *dagger.Directory, os string, osVer string, targetUsername string, targetPassword *dagger.Secret, upstreamRegistry string, upstreamOrg string, upstreamRepo string, upstreamSemver string, targetRegistry string, targetOrg string, targetSemver string, platforms string) []string  {
	return dag.
			DockerAnsible().
			TestRole(ctx, roleName, roleDir, os, osVer, targetUsername, targetPassword, upstreamRegistry, upstreamOrg, upstreamRepo, upstreamSemver, targetRegistry, targetOrg, targetSemver, platforms)
}
@function
async def example(role_name: str, role_dir: dagger.Directory, os: str, os_ver: str, target_username: str, target_password: dagger.Secret, upstream_registry: str, upstream_org: str, upstream_repo: str, upstream_semver: str, target_registry: str, target_org: str, target_semver: str, platforms: str) -> List[str]:
	return await (
		dag.docker_ansible()
		.test_role(role_name, role_dir, os, os_ver, target_username, target_password, upstream_registry, upstream_org, upstream_repo, upstream_semver, target_registry, target_org, target_semver, platforms)
	)
@func()
async example(roleName: string, roleDir: Directory, os: string, osVer: string, targetUsername: string, targetPassword: Secret, upstreamRegistry: string, upstreamOrg: string, upstreamRepo: string, upstreamSemver: string, targetRegistry: string, targetOrg: string, targetSemver: string, platforms: string): Promise<string[]> {
	return dag
		.dockerAnsible()
		.testRole(roleName, roleDir, os, osVer, targetUsername, targetPassword, upstreamRegistry, upstreamOrg, upstreamRepo, upstreamSemver, targetRegistry, targetOrg, targetSemver, platforms)
}