Skip to content

Ansible Core

Version: 1.0.0 | Tests: Passing

devcontainer.json
{
    "features": {
        "ghcr.io/infrashift/trusted-devcontainer-features/ansible-core:latest": {
            "target_version": "2.18.2",
            "target_python_version": "3.12"
        }
    }
}
OptionTypeDefaultDescription
target_versionstring2.18.2Select the ansible-core version to install
target_python_versionstring3.12Select which Python version to use for the ansible-core venv
pythonthis feature

Ansible Core is installed into a dedicated virtual environment managed by UV, the fast Python package manager from Astral. Rather than installing ansible-core globally or cluttering the system Python, this feature creates a fully isolated environment that keeps your devcontainer clean and reproducible.

The install script delegates to an Ansible playbook via uv run --with ansible-core ansible-playbook, which bootstraps the installation process. It creates an isolated Python venv at the specified version, installs ansible-core into it, and symlinks the ansible, ansible-playbook, and related binaries into ~/.local/bin so they are available on PATH.

This feature depends on the Python feature, which itself depends on UV & Ruff. When you include ansible-core in your devcontainer configuration, the dependency chain ensures that UV is installed first, then Python is set up at the requested version, and finally ansible-core is installed into its own venv. This layered approach means you can pin both the Python version and the ansible-core version independently.