7.4. ポリシー適用の入力と出力
次の入力と出力を使用して、ポリシー適用に使用するポリシーを作成します。
入力 | 型 | 説明 |
---|---|---|
| Integer | ジョブの一意の識別子。 |
| String | ジョブテンプレート名。 |
| Datetime (ISO 8601) | ジョブが作成された日時を示すタイムスタンプ。 |
| Object | ジョブを作成したユーザーに関する情報。
|
| Object のリスト | ジョブ実行に関連付けられた認証情報。
|
| Object | ジョブに使用される実行環境の詳細。
|
| JSON | ジョブ実行用に提供される追加の変数。 |
| Integer | ジョブ実行に使用される並列プロセスの数。 |
| Integer | ジョブの対象となるホストの数。 |
| Object | ジョブを処理するインスタンスグループに関する情報。以下が含まれます。
|
| Object | ジョブ実行で使用されるインベントリーの詳細。以下が含まれます。
|
| Object | ジョブテンプレートに関する情報。以下が含まれます。
|
| 選択肢 (String) | ジョブ実行のタイプ。使用できる値は次のとおりです。
|
| String | ジョブタイプの判読可能な名前。 |
| Object のリスト | ジョブに関連付けられたラベル。以下が含まれます。
|
| 選択肢 (String) | ジョブが開始された方法。使用できる値は次のとおりです。
|
| String | ジョブ実行に適用される制限。 |
| Object | ジョブを開始したユーザーに関する情報。以下が含まれます。
|
| Object | ジョブに関連付けられた組織に関する情報。以下が含まれます。
|
| String | ジョブ実行で使用される Playbook。 |
| Object | ジョブに関連付けられたプロジェクトの詳細。以下が含まれます。
|
| String | SCM に使用する特定のブランチ。 |
| String | ジョブに使用する SCM リビジョン。 |
| Object | ワークフロージョブの詳細 (ジョブがワークフローの一部である場合)。 |
| Object | ワークフロージョブテンプレートの詳細。 |
例
次のコードブロックは、デモジョブテンプレートの起動以降の入力データ例を示しています。
{ "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 } }
{
"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
}
}
入力 | 型 | 説明 |
---|---|---|
| Boolean | アクションが許可されているかどうかを示します |
| String のリスト | アクションが許可されない理由 |
例
次のコードブロックは、OPA ポリシークエリーからの予想される出力の例を示しています。
{ "allowed": false, "violations": [ "No job execution is allowed", ... ], ... }
{
"allowed": false,
"violations": [
"No job execution is allowed",
...
],
...
}