Policy enforcement input and output options
Use the following inputs and outputs to craft policies for use in policy enforcement.
| Input | Type | Description |
|---|---|---|
| |
Integer |
The job’s unique identifier. |
| |
String |
Job template name. |
| |
Datetime (ISO 8601) |
Timestamp indicating when the job was created. |
| |
Object |
Information about the user who created the job.
|
| |
List of objects |
Credentials associated with job execution.
|
| |
Object |
Details about the execution environment used for the job.
|
| |
JSON |
Extra variables provided for job execution. |
| |
Integer |
The number of parallel processes used for job execution. |
| |
Integer |
The number of hosts targeted by the job. |
| |
Object |
Information about the instance group handling the job, including:
|
| |
Object |
Inventory details used in the job execution, including:
|
| |
Object |
Information about the job template, including:
|
| |
Choice (String) |
Type of job execution. Allowed values are:
|
| |
String |
Human-readable name for the job type. |
| |
List of objects |
Labels associated with the job, including:
|
| |
Choice (String) |
How the job was launched. Allowed values include:
|
| |
String |
The limit applied to the job execution. |
| |
Object |
Information about the user who launched the job, including:
|
| |
Object |
Information about the organization associated with the job, including:
|
| |
String |
The playbook used in the job execution. |
| |
Object |
Details about the project associated with the job, including:
|
| |
String |
The specific branch to use for SCM. |
| |
String |
SCM revision used for the job. |
| |
Object |
Workflow job details, if the job is part of a workflow. |
| |
Object |
Workflow job template details. |
The following code block shows example input data from a demo job template launch:
{
"id": 70,
"name": "Demo Job Template",
"created": "2025-03-19T19:07:03.329426Z",
"created_by": {
"id": 1,
"username": "admin",
"is_superuser": true,
"teams": []
},
"credentials": [
{
"id": 3,
"name": "Example Machine Credential",
"description": "",
"organization": null,
"credential_type": 1,
"managed": false,
"kind": "ssh",
"cloud": false,
"kubernetes": false
}
],
"execution_environment": {
"id": 2,
"name": "Default execution environment",
"image": "registry.redhat.io/ansible-automation-platform-25/ee-supported-rhel8@sha256:b9f60d9ebbbb5fdc394186574b95dea5763b045ceff253815afeb435c626914d",
"pull": ""
},
"extra_vars": {
"example": "value"
},
"forks": 0,
"hosts_count": 0,
"instance_group": {
"id": 2,
"name": "default",
"capacity": 0,
"jobs_running": 1,
"jobs_total": 38,
"max_concurrent_jobs": 0,
"max_forks": 0
},
"inventory": {
"id": 1,
"name": "Demo Inventory",
"description": "",
"kind": "",
"total_hosts": 1,
"total_groups": 0,
"has_inventory_sources": false,
"total_inventory_sources": 0,
"has_active_failures": false,
"hosts_with_active_failures": 0,
"inventory_sources": []
},
"job_template": {
"id": 7,
"name": "Demo Job Template",
"job_type": "run"
},
"job_type": "run",
"job_type_name": "job",
"labels": [
{
"id": 1,
"name": "Demo label",
"organization": {
"id": 1,
"name": "Default"
}
}
],
"launch_type": "workflow",
"limit": "",
"launched_by": {
"id": 1,
"name": "admin",
"type": "user",
"url": "/api/v2/users/1/"
},
"organization": {
"id": 1,
"name": "Default"
},
"playbook": "hello_world.yml",
"project": {
"id": 6,
"name": "Demo Project",
"status": "successful",
"scm_type": "git",
"scm_url": "https://github.com/ansible/ansible-tower-samples",
"scm_branch": "",
"scm_refspec": "",
"scm_clean": false,
"scm_track_submodules": false,
"scm_delete_on_update": false
},
"scm_branch": "",
"scm_revision": "",
"workflow_job": {
"id": 69,
"name": "Demo Workflow"
},
"workflow_job_template": {
"id": 10,
"name": "Demo Workflow",
"job_type": null
}
}
| Input | Type | Description |
|---|---|---|
| |
Boolean |
Indicates whether the action is permitted |
| |
List of strings |
Reasons why the action is not permitted |
The following code block shows an example of expected output from the OPA policy query:
{
"allowed": false,
"violations": [
"No job execution is allowed",
...
],
...
}