Create Template

Create Template

API createtemplate
Purpose To create the template
API URL URL>:<API Port>/v2/ansibleAWX/createtemplate/orgentityid/{orgentityid}
Authentication type: Basic /Token
Method Type: Post
Request Format:
{
  "TemplateName": "TestTemplateName_Shubham",
  "RoleName": "Test_Role",
  "Content": "Test",
  "Environment": "Windows",
  "ToolId": 4,
   "InventoryId": 3,
  "ProjectId": 8,
  "CredentialIds": [3,4]
}

Parameters Required for Request Body

Column Column Type Mandatory Expected/Sample Value Remarks
orgentityid Integer Yes 1 This field contains Organization Identity
TemplateName String Yes Test_template This field contains template name
RoleName String Yes Test_role This field contains role name, inside this we will keep main.yml file.
Content String Yes Info:

name: abc
job: Developer
skill: Test

This field contains the content of YAML fill which we will keep in main.yaml for template execution.
Environment String Yes Windows or Linux This field contains the environment of server file.
ToolId String Yes Runbook tool Id This field contains runbook tool Identity
InventoryId Integer Yes InventoryId This field contains Inventory Id, that belongs to Ansible Inventory
ProjectId Integer Yes ProjectId This field contains Project Id, that belongs to Ansible Inventory
CredentialIds Integer Array No CredentialIds This field contains multiple Credential Ids, that belongs to Ansible Credentials
Output
{
  "Count": 1,
  "Result": {
    "RunbookName": "My_Job_Template_20240607134807",
    "RunbookOrganizationName": "Default",
    "RunbookPath": "/var/lib/awx/projects/GenAI_playbooks",
    "RBAToolRole": "Windows_TestRole_20240607134807"
  },
  "Status": "Success",
  "Message": "Template created successfully."
}

Parameters Returned from the Response of API

Column Column Type Value Remarks
RunbookName string My_Job_Template This field provide unique template name, which we will use for Runbook creation.
RunbookOrganizationName string Default This fields contain template organization name , which we will use as runbook organization.
RunbookPath string /var/lib/awx/projects/GenAI_playbooks This fields contain the path where we create new role
RBAToolRole string Windows_TestRole_20240607134807 This fields contain the role name inside this we created playbook, we will use this this field for runbook creation
Status string Success/Fail This field provide status
Message string Incident data saved successfully Success /fail message