Базовый сценарий#

В этом документе приведен базовый сценарий использования API Automation Controller. В ходе выполнения сценария производятся следующие действия:

  1. Получение токена авторизации.

  2. Создание организации.

  3. Добавление полномочий Ansible Galaxy для созданной организации.

  4. Создание инвентаря.

  5. Добавление управляемого узла в инвентарь.

  6. Создание проекта.

  7. Создание шаблона задания для установки NGINX.

  8. Запуск шаблона задания.

  9. Проверка статуса выполнения задания.

Предварительные требования#

Перед выполнением сценария произведите следующие действия в графическом интерфейсе контроллера:

  1. Создайте полномочия для доступа к следующим ресурсам:

    • управляемый узел;

    • Ansible Galaxy;

    • источник проектов.

    Примечание

    Управление полномочиями объясняется в описании графического интерфейса.

  2. Получите идентификаторы созданных полномочий:

    1. На панели навигации выберите Автоматизация процессов ‣ Инфраструктура ‣ Полномочия (Automation Execution ‣ Infrastructure ‣ Credentials).

    2. Нажмите на ссылку с названием нужного полномочия, например, Ansible Galaxy.

    3. Скопируйте <credentials_id> в адресной строке браузера, которая имеет следующий вид https://<address>/#/credentials/<credentials_id>/details.

Подготовка организационной структуры#

Для подготовки организационной структуры выполните следующие действия:

  1. Получите токен авторизации.

  2. Получите идентификатор среды исполнения в графическом интерфейсе контроллера:

    1. На панели навигации выберите Автоматизация процессов ‣ Инфраструктура ‣ Среды исполнения (Automation Execution ‣ Infrastructure ‣ Execution Environments).

    2. Нажмите на ссылку с названием нужной среды исполнения, например, Default execution environment.

    3. Скопируйте <execution_environment_id> в адресной строке браузера, которая имеет следующий вид https://<address>/execution/infrastructure/execution-environments/<execution_environments_id>/details.

  3. Создайте организацию:

    curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer <your_token>' \
       -d '{
                "name": "<your_organization_name>",
                "default_environment": "<execution_environment_id>"
           }' \
       https://<address>/api/gateway/v1/organizations/ | jq .
    

    Подставьте собственные значения параметров вместо употребленных в примере:

    • <address> – FQDN или IP-адрес контроллера, например, 192.168.56.11;

    • <your_token> – токен, полученный на предыдущем шаге, например, 3wijiG7********VtL2gseJESzjJsD;

    • <your_organization_name> – название организации, например, Jupiter;

    • <execution_environment_id> – идентификатор среды исполнения, например, 2.

    Organization
    {
      "id": 4,
      "url": "/api/gateway/v1/organizations/4/",
      "related": {
        "activity_stream": "/api/gateway/v1/activitystream/?content_type=3&object_id=4",
        "created_by": "/api/gateway/v1/users/2/",
        "modified_by": "/api/gateway/v1/users/2/",
        "teams": "/api/gateway/v1/organizations/4/teams/",
        "users": "/api/gateway/v1/organizations/4/users/",
        "admins": "/api/gateway/v1/organizations/4/admins/"
      },
      "summary_fields": {
        "modified_by": {
          "id": 2,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "created_by": {
          "id": 2,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "resource": {
          "ansible_id": "3db59f6d-1f89-452e-94b6-4fa2adaa811c",
          "resource_type": "shared.organization"
        },
        "related_field_counts": {
          "teams": 0,
          "users": 0
        }
      },
      "created": "2025-11-25T09:08:20.772225Z",
      "created_by": 2,
      "modified": "2025-11-25T09:08:20.772144Z",
      "modified_by": 2,
      "name": "Jupiter",
      "description": "",
      "managed": false
    }
    
  4. Добавьте полномочия Ansible Galaxy для созданной организации:

    curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer <your_token>' \
       -d '{
                "id":<credentials_id>
           }' \
       https://<address>/api/controller/v2/organizations/<organization_id>/galaxy_credentials/ | jq .
    

    Подставьте собственные значения параметров вместо употребленных в примере:

    • <credentials_id> – идентификатор полномочий для доступа к Ansible Galaxy, например, 2;

    • <organization_id> – идентификатор организации, созданной ранее, например, 4.

Подготовка инвентаря#

Для подготовки инвентаря выполните следующие действия:

  1. Создайте инвентарь:

    curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer <address>' \
       -d '{
                "name": "<your_inventory_name>",
                "organization": <organization_id>
           }' \
       https://<address>/api/controller/v2/inventories/ | jq .
    

    Подставьте собственные значения параметров вместо употребленных в примере. Здесь <your_inventory_name> – название инвентаря, например, Demo Inventory.

    Inventory
    {
      "id": 3,
      "type": "inventory",
      "url": "/api/controller/v2/inventories/3/",
      "related": {
        "named_url": "/api/controller/v2/inventories/Demo Inventory++Jupiter/",
        "created_by": "/api/controller/v2/users/1/",
        "modified_by": "/api/controller/v2/users/1/",
        "hosts": "/api/controller/v2/inventories/3/hosts/",
        "variable_data": "/api/controller/v2/inventories/3/variable_data/",
        "script": "/api/controller/v2/inventories/3/script/",
        "activity_stream": "/api/controller/v2/inventories/3/activity_stream/",
        "job_templates": "/api/controller/v2/inventories/3/job_templates/",
        "ad_hoc_commands": "/api/controller/v2/inventories/3/ad_hoc_commands/",
        "access_list": "/api/controller/v2/inventories/3/access_list/",
        "object_roles": "/api/controller/v2/inventories/3/object_roles/",
        "instance_groups": "/api/controller/v2/inventories/3/instance_groups/",
        "copy": "/api/controller/v2/inventories/3/copy/",
        "labels": "/api/controller/v2/inventories/3/labels/",
        "groups": "/api/controller/v2/inventories/3/groups/",
        "root_groups": "/api/controller/v2/inventories/3/root_groups/",
        "update_inventory_sources": "/api/controller/v2/inventories/3/update_inventory_sources/",
        "inventory_sources": "/api/controller/v2/inventories/3/inventory_sources/",
        "tree": "/api/controller/v2/inventories/3/tree/",
        "organization": "/api/controller/v2/organizations/4/"
      },
      "summary_fields": {
        "organization": {
          "id": 4,
          "name": "Jupiter",
          "description": ""
        },
        "created_by": {
          "id": 1,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "modified_by": {
          "id": 1,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "object_roles": {
          "admin_role": {
            "description": "Can manage all aspects of the inventory",
            "name": "Admin",
            "id": 123
          },
          "update_role": {
            "description": "May update the inventory",
            "name": "Update",
            "id": 124
          },
          "adhoc_role": {
            "description": "May run ad hoc commands on the inventory",
            "name": "Ad Hoc",
            "id": 125
          },
          "use_role": {
            "description": "Can use the inventory in a job template",
            "name": "Use",
            "id": 126
          },
          "read_role": {
            "description": "May view settings for the inventory",
            "name": "Read",
            "id": 127
          }
        },
        "user_capabilities": {
          "edit": true,
          "delete": true,
          "copy": true,
          "adhoc": true
        },
        "labels": {
          "count": 0,
          "results": []
        }
      },
      "created": "2025-11-25T09:47:53.058074Z",
      "modified": "2025-11-25T09:47:53.058086Z",
      "name": "Demo Inventory",
      "description": "",
      "organization": 4,
      "kind": "",
      "host_filter": null,
      "variables": "",
      "has_active_failures": false,
      "total_hosts": 0,
      "hosts_with_active_failures": 0,
      "total_groups": 0,
      "has_inventory_sources": false,
      "total_inventory_sources": 0,
      "inventory_sources_with_failures": 0,
      "pending_deletion": false,
      "prevent_instance_group_fallback": false
    }
    
  2. Добавьте управляемый узел в инвентарь:

    curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer <your_token>' \
       -d '{
                "name": "<node_ip>",
                "description": "<node_name>",
                "inventory": <inventory_id>,
                "enabled": true
           }' \
       https://<address>/api/controller/v2/hosts/ | jq .
    

    Подставьте собственные значения параметров вместо употребленных в примере:

    • <node_ip> – IP-адрес управляемого узла например, 10.2.0.6;

    • <node_name> – название управляемого узла, например, node01;

    • <inventory_id> – идентификатор инвентаря, например, 3.

    Host
    {
      "id": 3,
      "type": "host",
      "url": "/api/controller/v2/hosts/3/",
      "related": {
        "named_url": "/api/controller/v2/hosts/10.2.0.6++Demo Inventory++Jupiter/",
        "created_by": "/api/controller/v2/users/1/",
        "modified_by": "/api/controller/v2/users/1/",
        "variable_data": "/api/controller/v2/hosts/3/variable_data/",
        "groups": "/api/controller/v2/hosts/3/groups/",
        "all_groups": "/api/controller/v2/hosts/3/all_groups/",
        "job_events": "/api/controller/v2/hosts/3/job_events/",
        "job_host_summaries": "/api/controller/v2/hosts/3/job_host_summaries/",
        "activity_stream": "/api/controller/v2/hosts/3/activity_stream/",
        "inventory_sources": "/api/controller/v2/hosts/3/inventory_sources/",
        "smart_inventories": "/api/controller/v2/hosts/3/smart_inventories/",
        "ad_hoc_commands": "/api/controller/v2/hosts/3/ad_hoc_commands/",
        "ad_hoc_command_events": "/api/controller/v2/hosts/3/ad_hoc_command_events/",
        "ansible_facts": "/api/controller/v2/hosts/3/ansible_facts/",
        "inventory": "/api/controller/v2/inventories/3/"
      },
      "summary_fields": {
        "inventory": {
          "id": 3,
          "name": "Demo Inventory",
          "description": "",
          "has_active_failures": false,
          "total_hosts": 0,
          "hosts_with_active_failures": 0,
          "total_groups": 0,
          "has_inventory_sources": false,
          "total_inventory_sources": 0,
          "inventory_sources_with_failures": 0,
          "organization_id": 4,
          "kind": ""
        },
        "created_by": {
          "id": 1,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "modified_by": {
          "id": 1,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "user_capabilities": {
          "edit": true,
          "delete": true
        },
        "groups": {
          "count": 0,
          "results": []
        },
        "recent_jobs": []
      },
      "created": "2025-11-25T09:54:32.429608Z",
      "modified": "2025-11-25T09:54:32.429628Z",
      "name": "10.2.0.6",
      "description": "node01",
      "inventory": 3,
      "enabled": true,
      "instance_id": "",
      "variables": "",
      "has_active_failures": false,
      "has_inventory_sources": false,
      "last_job": null,
      "last_job_host_summary": null,
      "ansible_facts_modified": null
    }
    

Подготовка задания#

Для подготовки задания выполните следующие действия:

  1. Создайте проект:

    curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer <your_token>' \
       -d '{
                "name": "<your_project_name>",
                "scm_type": "git",
                "scm_url": "https://github.com/ansible/ansible-tower-samples",
                "scm_branch": "master",
                "default_environment": <environment_id>,
                "credential": <credential_id>,
                "organization": <organization_id>
           }' \
       https://<address>/api/controller/v2/projects/ | jq .
    

    Подставьте собственные значения параметров вместо употребленных в примере:

    • <your_project_name> – название проекта, например, Demo Project;

    • <credentials_id> – идентификатор полномочий для доступа к источнику проекта, если такие полномочия необходимы.

    Project
    {
      "id": 12,
      "type": "project",
      "url": "/api/controller/v2/projects/12/",
      "related": {
        "named_url": "/api/controller/v2/projects/Demo Project++Jupiter/",
        "created_by": "/api/controller/v2/users/1/",
        "modified_by": "/api/controller/v2/users/1/",
        "credential": "/api/controller/v2/credentials/4/",
        "current_job": "/api/controller/v2/project_updates/19/",
        "teams": "/api/controller/v2/projects/12/teams/",
        "playbooks": "/api/controller/v2/projects/12/playbooks/",
        "inventory_files": "/api/controller/v2/projects/12/inventories/",
        "update": "/api/controller/v2/projects/12/update/",
        "project_updates": "/api/controller/v2/projects/12/project_updates/",
        "scm_inventory_sources": "/api/controller/v2/projects/12/scm_inventory_sources/",
        "schedules": "/api/controller/v2/projects/12/schedules/",
        "activity_stream": "/api/controller/v2/projects/12/activity_stream/",
        "notification_templates_started": "/api/controller/v2/projects/12/notification_templates_started/",
        "notification_templates_success": "/api/controller/v2/projects/12/notification_templates_success/",
        "notification_templates_error": "/api/controller/v2/projects/12/notification_templates_error/",
        "access_list": "/api/controller/v2/projects/12/access_list/",
        "object_roles": "/api/controller/v2/projects/12/object_roles/",
        "copy": "/api/controller/v2/projects/12/copy/",
        "organization": "/api/controller/v2/organizations/4/",
        "default_environment": "/api/controller/v2/execution_environments/2/",
        "current_update": "/api/controller/v2/project_updates/19/"
      },
      "summary_fields": {
        "organization": {
          "id": 4,
          "name": "Jupiter",
          "description": ""
        },
        "default_environment": {
          "id": 2,
          "name": "Default execution environment",
          "description": "",
          "image": "hub.astra-automation.ru/aa-1.2/aa-full-ee:latest"
        },
        "credential": {
          "id": 4,
          "name": "SCM access",
          "description": "",
          "kind": "scm",
          "cloud": false,
          "kubernetes": false,
          "credential_type_id": 8
        },
        "current_update": {
          "id": 19,
          "name": "Demo Project",
          "description": "",
          "status": "pending",
          "failed": false
        },
        "current_job": {
          "id": 19,
          "name": "Demo Project",
          "description": "",
          "status": "pending",
          "failed": false
        },
        "created_by": {
          "id": 1,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "modified_by": {
          "id": 1,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "object_roles": {
          "admin_role": {
            "description": "Can manage all aspects of the project",
            "name": "Admin",
            "id": 128
          },
          "use_role": {
            "description": "Can use the project in a job template",
            "name": "Use",
            "id": 129
          },
          "update_role": {
            "description": "May update the project",
            "name": "Update",
            "id": 130
          },
          "read_role": {
            "description": "May view settings for the project",
            "name": "Read",
            "id": 131
          }
        },
        "user_capabilities": {
          "edit": true,
          "delete": true,
          "start": true,
          "schedule": true,
          "copy": true
        }
      },
      "created": "2025-11-25T10:00:14.421954Z",
      "modified": "2025-11-25T10:00:14.421985Z",
      "name": "Demo Project",
      "description": "",
      "local_path": "_12__demo_nginx_project",
      "scm_type": "git",
      "scm_url": "https://github.com/ansible/ansible-tower-samples",
      "scm_branch": "master",
      "scm_refspec": "",
      "scm_clean": false,
      "scm_track_submodules": false,
      "scm_delete_on_update": false,
      "credential": 4,
      "timeout": 0,
      "scm_revision": "",
      "last_job_run": null,
      "last_job_failed": false,
      "next_job_run": null,
      "status": "pending",
      "organization": 4,
      "scm_update_on_launch": false,
      "scm_update_cache_timeout": 0,
      "allow_override": false,
      "custom_virtualenv": null,
      "default_environment": 2,
      "signature_validation_credential": null,
      "last_update_failed": false,
      "last_updated": null
    }
    
  2. Создайте шаблон задания:

    curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer <your_token>' \
       -d '{
                "name": "<job_templates_name>",
                "job_type": "run",
                "inventory": <inventory_id>,
                "project": <project_id>,
                "playbook": "<playbook_name>"
           }' \
       https://<address>/api/controller/v2/job_templates/ | jq .
    

    Подставьте собственные значения параметров вместо употребленных в примере. Здесь

    • <job_templates_name> – название шаблона задания, например, Demo Job templates;

    • <project_id> – идентификатор проекта, созданного ранее, например, 12;

    • <playbook_name> – название используемого набора сценариев, например, hello_world.yml.

    Job template
    {
      "id": 14,
      "type": "job_template",
      "url": "/api/controller/v2/job_templates/14/",
      "related": {
        "named_url": "/api/controller/v2/job_templates/Demo Job templates++Jupiter/",
        "created_by": "/api/controller/v2/users/1/",
        "modified_by": "/api/controller/v2/users/1/",
        "labels": "/api/controller/v2/job_templates/14/labels/",
        "inventory": "/api/controller/v2/inventories/3/",
        "project": "/api/controller/v2/projects/12/",
        "organization": "/api/controller/v2/organizations/4/",
        "credentials": "/api/controller/v2/job_templates/14/credentials/",
        "jobs": "/api/controller/v2/job_templates/14/jobs/",
        "schedules": "/api/controller/v2/job_templates/14/schedules/",
        "activity_stream": "/api/controller/v2/job_templates/14/activity_stream/",
        "launch": "/api/controller/v2/job_templates/14/launch/",
        "webhook_key": "/api/controller/v2/job_templates/14/webhook_key/",
        "webhook_receiver": "",
        "notification_templates_started": "/api/controller/v2/job_templates/14/notification_templates_started/",
        "notification_templates_success": "/api/controller/v2/job_templates/14/notification_templates_success/",
        "notification_templates_error": "/api/controller/v2/job_templates/14/notification_templates_error/",
        "access_list": "/api/controller/v2/job_templates/14/access_list/",
        "survey_spec": "/api/controller/v2/job_templates/14/survey_spec/",
        "object_roles": "/api/controller/v2/job_templates/14/object_roles/",
        "instance_groups": "/api/controller/v2/job_templates/14/instance_groups/",
        "slice_workflow_jobs": "/api/controller/v2/job_templates/14/slice_workflow_jobs/",
        "copy": "/api/controller/v2/job_templates/14/copy/"
      },
      "summary_fields": {
        "organization": {
          "id": 4,
          "name": "Jupiter",
          "description": ""
        },
        "inventory": {
          "id": 3,
          "name": "Demo Inventory",
          "description": "",
          "has_active_failures": false,
          "total_hosts": 1,
          "hosts_with_active_failures": 0,
          "total_groups": 0,
          "has_inventory_sources": false,
          "total_inventory_sources": 0,
          "inventory_sources_with_failures": 0,
          "organization_id": 4,
          "kind": ""
        },
        "project": {
          "id": 12,
          "name": "Demo Project",
          "description": "",
          "status": "successful",
          "scm_type": "git",
          "allow_override": false
        },
        "created_by": {
          "id": 1,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "modified_by": {
          "id": 1,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "object_roles": {
          "admin_role": {
            "description": "Can manage all aspects of the job template",
            "name": "Admin",
            "id": 138
          },
          "execute_role": {
            "description": "May run the job template",
            "name": "Execute",
            "id": 139
          },
          "read_role": {
            "description": "May view settings for the job template",
            "name": "Read",
            "id": 140
          }
        },
        "user_capabilities": {
          "edit": true,
          "delete": true,
          "start": true,
          "schedule": true,
          "copy": true
        },
        "labels": {
          "count": 0,
          "results": []
        },
        "recent_jobs": [],
        "credentials": []
      },
      "created": "2025-11-25T11:26:03.595428Z",
      "modified": "2025-11-25T11:26:03.595453Z",
      "name": "Demo Job templates",
      "description": "",
      "job_type": "run",
      "inventory": 3,
      "project": 12,
      "playbook": "hello_world.yml",
      "scm_branch": "",
      "forks": 0,
      "limit": "",
      "verbosity": 0,
      "extra_vars": "",
      "job_tags": "",
      "force_handlers": false,
      "skip_tags": "",
      "start_at_task": "",
      "timeout": 0,
      "use_fact_cache": false,
      "organization": 4,
      "last_job_run": null,
      "last_job_failed": false,
      "next_job_run": null,
      "status": "never updated",
      "execution_environment": null,
      "host_config_key": "",
      "ask_scm_branch_on_launch": false,
      "ask_diff_mode_on_launch": false,
      "ask_variables_on_launch": false,
      "ask_limit_on_launch": false,
      "ask_tags_on_launch": false,
      "ask_skip_tags_on_launch": false,
      "ask_job_type_on_launch": false,
      "ask_verbosity_on_launch": false,
      "ask_inventory_on_launch": false,
      "ask_credential_on_launch": false,
      "ask_execution_environment_on_launch": false,
      "ask_labels_on_launch": false,
      "ask_forks_on_launch": false,
      "ask_job_slice_count_on_launch": false,
      "ask_timeout_on_launch": false,
      "ask_instance_groups_on_launch": false,
      "survey_enabled": false,
      "become_enabled": false,
      "diff_mode": false,
      "allow_simultaneous": false,
      "custom_virtualenv": null,
      "job_slice_count": 1,
      "webhook_service": "",
      "webhook_credential": null,
      "prevent_instance_group_fallback": false
    }
    
  3. Добавьте полномочия для шаблона задания:

    curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer <your_token>' \
       -d '{
                "id":<credential_id>
           }' \
       https://<address>/api/controller/v2/job_templates/<job_template_id>/credentials/ | jq .
    

    Подставьте собственные значения параметров вместо употребленных в примере:

    • <credentials_id> – идентификатор полномочий для доступа к управляемому узлу, например, 1;

    • <job_template_id> – идентификатор созданного ранее шаблона задания, например, 14.

Выполнение и проверка задания#

Для запуска и проверки статуса задания выполните следующие действия:

  1. Запустите задание, используя созданный шаблон:

    curl -X POST \
       -H 'Authorization: Bearer <your_token>' \
       https://<address>/api/controller/v2/job_templates/<job_template_id>/launch/ | jq .
    
    Job template
    {
      "job": 25,
      "ignored_fields": {},
      "id": 25,
      "type": "job",
      "url": "/api/controller/v2/jobs/25/",
      "related": {
        "created_by": "/api/controller/v2/users/1/",
        "modified_by": "/api/controller/v2/users/1/",
        "labels": "/api/controller/v2/jobs/25/labels/",
        "inventory": "/api/controller/v2/inventories/3/",
        "project": "/api/controller/v2/projects/12/",
        "organization": "/api/controller/v2/organizations/4/",
        "credentials": "/api/controller/v2/jobs/25/credentials/",
        "unified_job_template": "/api/controller/v2/job_templates/14/",
        "stdout": "/api/controller/v2/jobs/25/stdout/",
        "job_events": "/api/controller/v2/jobs/25/job_events/",
        "job_host_summaries": "/api/controller/v2/jobs/25/job_host_summaries/",
        "activity_stream": "/api/controller/v2/jobs/25/activity_stream/",
        "notifications": "/api/controller/v2/jobs/25/notifications/",
        "create_schedule": "/api/controller/v2/jobs/25/create_schedule/",
        "job_template": "/api/controller/v2/job_templates/14/",
        "cancel": "/api/controller/v2/jobs/25/cancel/",
        "relaunch": "/api/controller/v2/jobs/25/relaunch/"
      },
      "summary_fields": {
        "organization": {
          "id": 4,
          "name": "Jupiter",
          "description": ""
        },
        "inventory": {
          "id": 3,
          "name": "Demo Inventor",
          "description": "",
          "has_active_failures": false,
          "total_hosts": 1,
          "hosts_with_active_failures": 0,
          "total_groups": 0,
          "has_inventory_sources": false,
          "total_inventory_sources": 0,
          "inventory_sources_with_failures": 0,
          "organization_id": 4,
          "kind": ""
        },
        "project": {
          "id": 12,
          "name": "Demo Project",
          "description": "",
          "status": "successful",
          "scm_type": "git",
          "allow_override": false
        },
        "job_template": {
          "id": 14,
          "name": "Demo Job templates",
          "description": ""
        },
        "unified_job_template": {
          "id": 14,
          "name": "Demo Job templates",
          "description": "",
          "unified_job_type": "job"
        },
        "created_by": {
          "id": 1,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "modified_by": {
          "id": 1,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "user_capabilities": {
          "delete": true,
          "start": true
        },
        "labels": {
          "count": 0,
          "results": []
        },
        "credentials": [
          {
            "id": 6,
            "name": "Demo machine credential",
            "description": "",
            "kind": "ssh",
            "cloud": false
          }
        ]
      },
      "created": "2025-11-25T11:42:23.485635Z",
      "modified": "2025-11-25T11:42:23.580598Z",
      "name": "Demo Job templates",
      "description": "",
      "job_type": "run",
      "inventory": 3,
      "project": 12,
      "playbook": "hello_world.yml",
      "scm_branch": "",
      "forks": 0,
      "limit": "",
      "verbosity": 0,
      "extra_vars": "{}",
      "job_tags": "",
      "force_handlers": false,
      "skip_tags": "",
      "start_at_task": "",
      "timeout": 0,
      "use_fact_cache": false,
      "organization": 4,
      "unified_job_template": 14,
      "launch_type": "manual",
      "status": "pending",
      "execution_environment": null,
      "failed": false,
      "started": null,
      "finished": null,
      "canceled_on": null,
      "elapsed": 0,
      "job_args": "",
      "job_cwd": "",
      "job_env": {},
      "job_explanation": "",
      "execution_node": "",
      "controller_node": "",
      "result_traceback": "",
      "event_processing_finished": false,
      "launched_by": {
        "id": 1,
        "name": "admin",
        "type": "user",
        "url": "/api/controller/v2/users/1/"
      },
      "work_unit_id": null,
      "job_template": 14,
      "passwords_needed_to_start": [],
      "allow_simultaneous": false,
      "artifacts": {},
      "scm_revision": "",
      "instance_group": null,
      "diff_mode": false,
      "job_slice_number": 0,
      "job_slice_count": 1,
      "webhook_service": "",
      "webhook_credential": null,
      "webhook_guid": ""
    }
    
  2. Проверьте статус выполнения задания:

    curl -X GET \
       https://<address>/api/controller/v2/jobs/<id_job>/ \
       -H 'Authorization: Bearer <your_token>' \
       -k -s | jq .
    

    Подставьте собственные значения параметров вместо употребленных в примере. Здесь <id_job> – идентификатор задания, запущенного ранее, например, 25.

    Job
    {
      "id": 25,
      "type": "job",
      "url": "/api/controller/v2/jobs/25/",
      "related": {
        "created_by": "/api/controller/v2/users/1/",
        "labels": "/api/controller/v2/jobs/25/labels/",
        "inventory": "/api/controller/v2/inventories/3/",
        "project": "/api/controller/v2/projects/12/",
        "organization": "/api/controller/v2/organizations/4/",
        "credentials": "/api/controller/v2/jobs/25/credentials/",
        "unified_job_template": "/api/controller/v2/job_templates/14/",
        "stdout": "/api/controller/v2/jobs/25/stdout/",
        "execution_environment": "/api/controller/v2/execution_environments/2/",
        "job_events": "/api/controller/v2/jobs/25/job_events/",
        "job_host_summaries": "/api/controller/v2/jobs/25/job_host_summaries/",
        "activity_stream": "/api/controller/v2/jobs/25/activity_stream/",
        "notifications": "/api/controller/v2/jobs/25/notifications/",
        "create_schedule": "/api/controller/v2/jobs/25/create_schedule/",
        "job_template": "/api/controller/v2/job_templates/14/",
        "cancel": "/api/controller/v2/jobs/25/cancel/",
        "relaunch": "/api/controller/v2/jobs/25/relaunch/"
      },
      "summary_fields": {
        "organization": {
          "id": 4,
          "name": "Jupiter",
          "description": ""
        },
        "inventory": {
          "id": 3,
          "name": "Demo Inventory",
          "description": "",
          "has_active_failures": true,
          "total_hosts": 1,
          "hosts_with_active_failures": 1,
          "total_groups": 0,
          "has_inventory_sources": false,
          "total_inventory_sources": 0,
          "inventory_sources_with_failures": 0,
          "organization_id": 4,
          "kind": ""
        },
        "execution_environment": {
          "id": 2,
          "name": "Default execution environment",
          "description": "",
          "image": "hub.astra-automation.ru/aa-1.2/aa-full-ee:latest"
        },
        "project": {
          "id": 12,
          "name": "Demo Project",
          "description": "",
          "status": "successful",
          "scm_type": "git",
          "allow_override": false
        },
        "job_template": {
          "id": 14,
          "name": "Demo Job templates",
          "description": ""
        },
        "unified_job_template": {
          "id": 14,
          "name": "Demo Job templates",
          "description": "",
          "unified_job_type": "job"
        },
        "instance_group": {
          "id": 2,
          "name": "default",
          "is_container_group": false
        },
        "created_by": {
          "id": 1,
          "username": "admin",
          "first_name": "",
          "last_name": ""
        },
        "user_capabilities": {
          "delete": true,
          "start": true
        },
        "labels": {
          "count": 0,
          "results": []
        },
        "credentials": [
          {
            "id": 6,
            "name": "Demo machine credential",
            "description": "",
            "kind": "ssh",
            "cloud": false
          }
        ]
      },
      "created": "2025-11-25T11:42:23.485635Z",
      "modified": "2025-11-25T11:42:24.065872Z",
      "name": "Demo Job templates",
      "description": "",
      "job_type": "run",
      "inventory": 3,
      "project": 12,
      "playbook": "hello_world.yml",
      "scm_branch": "",
      "forks": 0,
      "limit": "",
      "verbosity": 0,
      "extra_vars": "{}",
      "job_tags": "",
      "force_handlers": false,
      "skip_tags": "",
      "start_at_task": "",
      "timeout": 0,
      "use_fact_cache": false,
      "organization": 4,
      "unified_job_template": 14,
      "launch_type": "manual",
      "status": "successful",
      "execution_environment": 2,
      "failed": false,
      "started": "2025-11-25T11:42:24.174853Z",
      "finished": "2025-11-25T11:42:39.374865Z",
      "canceled_on": null,
      "elapsed": 15.2,
      "job_args": "[\"podman\", \"run\", \"--rm\", \"--tty\", \"--interactive\", \"--workdir\", \"/runner/project\", \"-v\", \"/tmp/awx_25_m3pkq3po/:/runner/:Z\", \"-v\", \"/etc/ssl/certs/:/etc/ssl/certs/:O\", \"-v\", \"/usr/local/share/ca-certificates/:/usr/local/share/ca-certificates/:O\", \"--env-file\", \"/tmp/awx_25_m3pkq3po/artifacts/25/env.list\", \"--quiet\", \"--name\", \"ansible_runner_25\", \"--user=root\", \"--network\", \"slirp4netns:enable_ipv6=true\", \"hub.astra-automation.ru/aa-1.2/aa-full-ee:latest\", \"ansible-playbook\", \"-u\", \"root\", \"-i\", \"/runner/inventory\", \"-e\", \"@/runner/env/extravars\", \"hello_world.yml\"]",
      "job_cwd": "/runner/project",
      "job_explanation": "",
      "result_traceback": "",
      "event_processing_finished": true,
      "launched_by": {
        "id": 1,
        "name": "admin",
        "type": "user",
        "url": "/api/controller/v2/users/1/"
      },
      "work_unit_id": "1020521290cEbb2WhP",
      "job_template": 14,
      "passwords_needed_to_start": [],
      "allow_simultaneous": false,
      "artifacts": {},
      "scm_revision": "347e44fea036c94d5f60e544de006453ee5c71ad",
      "instance_group": 2,
      "diff_mode": false,
      "job_slice_number": 0,
      "job_slice_count": 1,
      "webhook_service": "",
      "webhook_credential": null,
      "webhook_guid": "",
      "host_status_counts": {
        "dark": 1
      },
      "playbook_counts": {
        "play_count": 1,
        "task_count": 1
      },
      "custom_virtualenv": null
    }
    

    Если в поле failed указано значение false, значит задание завершилось успешно.