What is an Execution Environment?
An Execution Environment (EE) is a container image that provides a consistent, portable, and isolated runtime for Ansible automation. Execution Environments package Ansible Core, collections, Python dependencies, and system packages into a single container image, ensuring jobs run with the exact dependencies they need.Execution Environments replaced the legacy virtual environment (venv) approach, providing better isolation, reproducibility, and dependency management.
Core Concepts
Container-Based Execution
All AWX jobs run in containers using execution environments. This provides:- Isolation: Each job runs in its own container with dedicated resources
- Consistency: Same environment across development, testing, and production
- Portability: Container images can be shared and versioned
- Security: Containerization provides process and filesystem isolation
docs/execution_environments.md:1-4:
All jobs use container isolation for environment consistency and security. Compliant images are referred to as Execution Environments (EE)s.
Execution Environment Model
From the ExecutionEnvironment model (awx/main/models/execution_environments.py:13-77):
| Field | Type | Description |
|---|---|---|
name | String | EE name (unique) |
description | String | Optional description |
organization | ForeignKey | Organization for scoping (null = global) |
image | String | Full container image location (registry/repo:tag) |
managed | Boolean | System-managed EE (not user-editable) |
credential | ForeignKey | Container registry credential |
pull | Choice | Pull policy: always, missing, or never |
Image Location
Theimage field specifies the full container image reference:
quay.io/ansible/awx-ee:latestregistry.example.com/my-custom-ee:v1.0.0docker.io/library/ubuntu:22.04
Pull Policies
Fromexecution_environments.py:19-23:
- always: Pull image before every job (ensures latest version)
- missing: Pull only if image not present locally (default behavior)
- never: Never pull, use local image only (requires pre-pulled images)
Global vs Organization EEs
Execution environments can be global or organization-scoped:Global Execution Environments
Fromdocs/execution_environments.md:17-20:
EEs without an organization (value is null in the API) are global EEs. Only superusers can create global EEs. These can become the global job default in certain circumstances.Global EEs are available to all organizations and can be set as defaults.
Organization Execution Environments
Organization-scoped EEs:- Only visible within the organization
- Manageable by organization admins with
execution_environment_admin_role - Used for organization-specific dependencies
Pre-Created Execution Environments
AWX installers should run this management command:docs/execution_environments.md:24-31, this creates:
-
Control Plane EE: Used for system operations
- Corresponds to
CONTROL_PLANE_EXECUTION_ENVIRONMENTsetting - Used for project updates, inventory updates, system jobs
- Corresponds to
-
Global Job EEs: Default execution environments for jobs
- All images from
GLOBAL_JOB_EXECUTION_ENVIRONMENTSsetting - Available as fallback for jobs
- All images from
Execution Environment Selection
For Jobs, Ad Hoc Commands, and Inventory Updates
Fromdocs/execution_environments.md:38-49, AWX selects EEs in this order:
- Template’s
execution_environment(job template or inventory source) - Project’s
default_environment - Organization’s
default_environment(of the job) - Organization’s
default_environment(of the inventory) DEFAULT_EXECUTION_ENVIRONMENTsetting- Any image from
GLOBAL_JOB_EXECUTION_ENVIRONMENTS - Any other global EE (most recently created)
For Project Updates
Fromdocs/execution_environments.md:34-35:
Project updates will always use the control plane EE.Projects cannot customize their update environment:
Building Execution Environments
Execution Environments are built using ansible-builder:Definition File
Create anexecution-environment.yml:
Requirements Files
requirements.yml (Ansible collections):Building the Image
Container Registry Authentication
Private registries require credentials:API Endpoints
List Execution Environments
Create Execution Environment
Create Global Execution Environment
Update Execution Environment
Setting Default Execution Environments
On Job Templates
On Projects
On Organizations
Global Default
Migrating from Custom Virtual Environments
For AWX installations that used custom venvs: Fromdocs/execution_environments.md:51-61:
Permissions
Execution environment permissions are enforced:- Managed EEs: No role assignments allowed
- Global EEs: No role assignments allowed (superuser access only)
- Organization EEs: User must have view permission on organization
Best Practices
Use Specific Tags
Use Specific Tags
Set Appropriate Pull Policy
Set Appropriate Pull Policy
Use
missing for production (faster, more predictable) and always for development (ensures latest code).Version Your EEs
Version Your EEs
Treat execution environments like application code: version them, test them, and promote through environments.
Minimize Image Size
Minimize Image Size
Only include necessary collections and packages. Smaller images pull faster and use less storage.
Use Private Registries
Use Private Registries
Host custom EEs in private registries with proper authentication for security and control.
Test Before Deploying
Test Before Deploying
Test execution environments thoroughly before using in production. Run sample playbooks to verify dependencies.
Document Dependencies
Document Dependencies
Maintain clear documentation of what collections and packages each EE contains and why.
Troubleshooting
Image Pull Failures
- Verify image name and tag are correct
- Check container registry credential
- Ensure AWX has network access to registry
- Check pull policy setting
Missing Dependencies
- Verify collections are installed in EE
- Check Python package versions
- Ensure system packages are present
- Review ansible-builder logs
Performance Issues
- Use
missingpull policy to avoid unnecessary pulls - Pre-pull images on AWX nodes
- Use local registry for faster pulls
- Consider image size and optimization
Related Resources
- Job Templates - Use EEs in job templates
- Projects - Set default EE for project jobs
- Organizations - Set organization-wide default EE
- Ansible Builder - Build custom EEs
- Execution Environment Guide - Comprehensive EE guide