Understanding Job Templates
A Job Template is a definition for running an Ansible playbook. It includes:- Project: Source of playbooks
- Playbook: The specific playbook to run
- Inventory: Target hosts and groups
- Credentials: Authentication for hosts and other services
- Execution Environment: Container image with Ansible and dependencies
- Variables: Extra variables to pass to the playbook
- Options: Verbosity, limits, tags, and other runtime settings
Job Types
Run
Execute the playbook normally (default)
Check
Dry-run mode - shows what would change without making changes
Creating a Job Template
Via Web UI
- Navigate to Templates in the sidebar
- Click Add → Add job template
- Fill in the required fields:
- Name: Descriptive name
- Job Type: Run or Check
- Inventory: Select target inventory
- Project: Select project with playbooks
- Playbook: Choose from available playbooks
- Credentials: Add required credentials
- Configure options:
- Verbosity: Output detail level (0-4)
- Forks: Parallel execution count
- Limit: Restrict to specific hosts
- Instance Groups: Where to run the job
- Click Save
Launching Jobs
Simple Launch
- Web UI
- API
- Ansible
- Navigate to Templates
- Click the rocket icon next to your template
- Fill in any prompted values
- Click Launch
Launch with Extra Variables
- API
- Ansible
Launch with Limit
Restrict execution to specific hosts:Launch with Different Inventory
Job Template Options
Credentials
Multiple credentials can be attached:- Machine (SSH): For host authentication
- Vault: Ansible Vault passwords
- Cloud: AWS, Azure, GCP credentials
- Network: Network device credentials
- Source Control: Git/SCM credentials
- Custom: User-defined credential types
Privilege Escalation
Enable privilege escalation (sudo):Verbosity Levels
Forks (Parallelism)
Control parallel execution:Job Tags
Run specific tagged tasks:Diff Mode
Show file changes:- Reviewing template changes
- Auditing configuration modifications
- Compliance reporting
Prompt on Launch
Allow users to override values when launching:ask_inventory_on_launchask_credential_on_launchask_variables_on_launchask_limit_on_launchask_tags_on_launchask_skip_tags_on_launchask_job_type_on_launchask_verbosity_on_launchask_diff_mode_on_launchask_scm_branch_on_launchask_execution_environment_on_launchask_forks_on_launchask_timeout_on_launchask_instance_groups_on_launch
Job Slicing
Distribute a job across multiple slices for large inventories:- Each slice processes 1/10th of the inventory
- Slices run in parallel
- Overall job completes faster
Execution Environments
Specify the container image to use:Instance Groups
Control where jobs execute:Job Lifecycle
Job States
Monitoring Job Progress
Waiting for Job Completion
Canceling Jobs
- Web UI
- API
- Ansible
Click the Cancel button on the job details page
Relaunching Jobs
Relaunch a job with the same parameters:- Same inventory, project, playbook
- Same credentials
- Same extra variables
- Same limit, tags, etc.
Simultaneous Jobs
By default, job templates don’t allow concurrent execution. Enable it:Webhooks
Trigger jobs via webhooks (GitHub, GitLab, etc.):- Repository Settings → Webhooks → Add webhook
- Payload URL: Your AWX webhook URL
- Content type:
application/json - Secret: Your webhook credential
- Events: Push, Pull Request, etc.
Job Templates vs. Workflows
Job Templates
Run a single playbookUse when:
- Single task to execute
- Simple automation
- No dependencies
Workflows
Chain multiple job templatesUse when:
- Multi-stage deployments
- Conditional logic
- Complex orchestration
Best Practices
Use Surveys
Create surveys for user-friendly variable input
Set Timeouts
Configure reasonable timeouts to prevent hung jobs
Limit Scope
Use limits and tags to minimize blast radius
Test in Check Mode
Always test with
job_type: check firstTroubleshooting
Job fails immediately
Job fails immediately
Common causes:
- Missing or invalid credentials
- Inventory is empty
- Project sync failed
- Playbook not found
Job stuck in pending
Job stuck in pending
Possible issues:
- No available instance groups
- Capacity limits reached
- Previous job blocking (simultaneous = false)
Playbook not found in project
Playbook not found in project
Verify:
- Project update completed successfully
- Playbook file has
.ymlor.yamlextension - Playbook is valid Ansible syntax
- File is in the project repository
Variables not applying
Variables not applying
Check variable precedence:
- Job extra_vars (highest)
- Job template extra_vars
- Survey responses
- Host/group variables
- Inventory variables (lowest)
Related Resources
Surveys
Add surveys to job templates for user input
Scheduling
Schedule jobs to run automatically
Notifications
Set up notifications for job status
Workflows
Create complex workflows with multiple jobs