> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/infrastructure-as-code-management/iacm-api-reference/ansible/create-ansible-inventory.md).

# Create Ansible inventory

Create a new inventory.

```json
{"openapi":"3.0.3","info":{"title":"Infrastructure as Code Management","version":"0.1.0"},"tags":[{"name":"ansible","description":"Ansible Service handles the API for ansible entities."}],"servers":[{"url":"http://localhost:80"}],"paths":{"/api/orgs/{org}/projects/{project}/ansible/inventory":{"post":{"tags":["ansible"],"summary":"Create Ansible inventory","description":"Create a new inventory.","operationId":"ansible#create-inventory","parameters":[{"name":"org","in":"path","description":"Org is the organisation identifier.","required":true,"schema":{"type":"string","description":"Org is the organisation identifier.","minLength":1,"maxLength":128}},{"name":"project","in":"path","description":"Project is the project identifier.","required":true,"schema":{"type":"string","description":"Project is the project identifier.","minLength":1,"maxLength":128}},{"name":"Harness-Account","in":"header","description":"Account is the internal customer account ID.","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Account is the internal customer account ID.","minLength":1,"maxLength":128}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInventoryRequest"}}}},"responses":{"201":{"description":"Created response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInventoryResponse"}}}},"400":{"description":"BadRequestError: Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/AnsiblePolicyViolationError"}}}},"401":{"description":"UnauthorizedError: Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/AnsibleError"}}}},"403":{"description":"ForbiddenError: Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/AnsibleError"}}}},"404":{"description":"NotFoundError: Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/AnsibleError"}}}},"408":{"description":"TimeoutError: Request Timeout response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/AnsibleError"}}}},"409":{"description":"ConflictError: Conflict response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/AnsibleError"}}}},"423":{"description":"LockedError: Locked response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/AnsibleError"}}}},"499":{"description":"ContextCancelledError:  response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/AnsibleError"}}}},"500":{"description":"InternalServerError: Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/AnsibleError"}}}},"502":{"description":"BadGatewayError: Bad Gateway response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/AnsibleError"}}}}}}}},"components":{"schemas":{"CreateInventoryRequest":{"type":"object","properties":{"description":{"type":"string","description":"Description documents the inventory purpose and usage","maxLength":1024},"dynamic_groups":{"type":"array","items":{"$ref":"#/components/schemas/CreateDynamicGroup"},"description":"Groups is the list of dynamic groups to use."},"groups":{"type":"array","items":{"$ref":"#/components/schemas/CreateManualGroup"},"description":"Groups is the list of manual groups to use."},"identifier":{"type":"string","description":"The unique identifier for this inventory"},"name":{"type":"string","description":"Name is the human readable name","minLength":1,"maxLength":1024},"plugin_options":{"$ref":"#/components/schemas/PluginOptions"},"remote_source":{"$ref":"#/components/schemas/RemoteSource"},"tags":{"type":"array","items":{"type":"string"},"description":"Tags associated with the inventory"},"type":{"type":"string","description":"Type indicates what kind of inventory this is","enum":["manual","dynamic","plugin","remote"]},"vars":{"type":"array","items":{"$ref":"#/components/schemas/AnsibleVariable"},"description":"Vars is the list of manual variables to use."}},"required":["type","name","identifier","data"]},"CreateDynamicGroup":{"type":"object","properties":{"configuration":{"$ref":"#/components/schemas/DynamicConfig"},"connector_identifier":{"type":"string","description":"Connector Identifier is the identifier of the connector to use."},"connector_type":{"type":"string","description":"Connector Type is the type of connector to use.","enum":["workspace","aws","gcp","azure","vault"]},"dynamic_vars":{"type":"array","items":{"$ref":"#/components/schemas/AnsibleVariable"},"description":"Dynamic Vars is the variables associated with the host."},"identifier":{"type":"string","description":"The identifier of the group"},"name":{"type":"string","description":"Name is the friendly name of the group."},"vars":{"type":"array","items":{"$ref":"#/components/schemas/AnsibleVariable"},"description":"Vars is the variables associated with the host."}},"required":["identifier","name","connector_identifier","connector_type"]},"DynamicConfig":{"type":"object","properties":{"host_address_attribute":{"type":"string","description":"Host address is the address of the host."},"resource_type":{"type":"string","description":"Type is the type of resource to select."},"selectors":{"type":"array","items":{"$ref":"#/components/schemas/ResourcesSelectorConditions"}}}},"ResourcesSelectorConditions":{"type":"object","properties":{"attribute":{"type":"string","description":"Attribute is the attribute to select on."},"operator":{"type":"string","description":"Operator is the operator to use for the selector.","enum":["equals","not_equals","contains","not_contains","starts_with","ends_with"]},"value":{"type":"string","description":"Value is the value to check."}},"required":["attribute","operator","value"]},"AnsibleVariable":{"type":"object","properties":{"file_name":{"type":"string","description":"Filename is where to store the value of the secret."},"key":{"type":"string","description":"Key is the identifier for the secret.","pattern":"^[a-zA-Z0-9_]+$","minLength":1,"maxLength":128},"uuid":{"type":"string","description":"UUID is the unique identifier for the secret."},"value":{"type":"string","description":"Value is the value of the secret."},"value_type":{"type":"string","description":"Type indecates the value type of the secret. In the case of secret this is a\nreference to an item in the secret store"}},"description":"AnsibleVariable is the representation for a single variable associated with ansible.","required":["key","value","value_type"]},"CreateManualGroup":{"type":"object","properties":{"hosts":{"type":"array","items":{"type":"string"},"description":"Groups is the list of hosts in the group."},"identifier":{"type":"string","description":"The identifier of the group"},"name":{"type":"string","description":"Name is the name of the group."},"vars":{"type":"array","items":{"$ref":"#/components/schemas/AnsibleVariable"},"description":"Vars is the variables associated with the host."}},"required":["identifier","name"]},"PluginOptions":{"type":"object","properties":{"inline_yaml":{"type":"string","description":"Inline plugin inventory YAML content."},"provider_connector_identifier":{"type":"string","description":"Provider connector identifier to use for plugin inventory execution."},"provider_connector_type":{"type":"string","description":"Provider connector type to use.","enum":["workspace","aws","gcp","azure","vault"]},"repository":{"type":"string","description":"Git repository name/identifier (required when source_type=git)."},"repository_branch":{"type":"string","description":"Git branch (optional; used when source_type=git)."},"repository_commit":{"type":"string","description":"Git commit/tag (optional; used when source_type=git)."},"repository_connector":{"type":"string","description":"Harness connector reference used to fetch repository content (required when source_type=git)."},"repository_path":{"type":"string","description":"Path within the repo to the plugin inventory YAML (required when source_type=git)."},"source_type":{"type":"string","description":"Source type for plugin inventory (git or inline).","enum":["git","inline"]}},"description":"plugin_options defines how plugin inventory content is sourced (inline or git) plus provider connector info."},"RemoteSource":{"type":"object","properties":{"repository":{"type":"string","description":"Git repository name/identifier."},"repository_branch":{"type":"string","description":"Git branch (optional; mutually exclusive with repository_commit)."},"repository_commit":{"type":"string","description":"Git commit or tag (optional; mutually exclusive with repository_branch)."},"repository_connector":{"type":"string","description":"Harness connector reference used to fetch repository content. Omit for Harness Code repositories."},"repository_path":{"type":"string","description":"Path within the repo to the inventory file or directory."}},"description":"remote_source is the git location a remote inventory's hosts, groups and group_vars are read from.","required":["repository","repository_path"]},"CreateInventoryResponse":{"type":"object","properties":{"account":{"type":"string","description":"Account is the internal customer account ID.","minLength":1,"maxLength":128},"created":{"type":"integer","description":"Timestamp when the resource was created.","format":"int64"},"description":{"type":"string","description":"Description documents the inventory purpose and usage","maxLength":1024},"identifier":{"type":"string","description":"The unique identifier for this inventory"},"name":{"type":"string","description":"Name is the human readable name","minLength":1,"maxLength":1024},"org":{"type":"string","description":"Org is the organisation identifier.","minLength":1,"maxLength":128},"policy_evaluation":{"$ref":"#/components/schemas/AnsibleEvaluation"},"project":{"type":"string","description":"Project is the project identifier.","minLength":1,"maxLength":128},"tags":{"type":"array","items":{"type":"string"},"description":"Tags associated with the inventory"},"type":{"type":"string","description":"Type indicates what kind of inventory this is","enum":["manual","dynamic","plugin","remote"]},"updated":{"type":"integer","description":"Timestamp when the resource was last updated.","format":"int64"}},"required":["created","updated","account","org","project","identifier","name","type","data"]},"AnsibleEvaluation":{"type":"object","properties":{"account_id":{"type":"string","description":"The Harness account in which the evaluation was performed"},"action":{"type":"string","description":"The action that triggered evaluation"},"created":{"type":"integer","description":"The time at which the evaluation was performed in Unix time milliseconds","format":"int64"},"details":{"type":"array","items":{"$ref":"#/components/schemas/AnsibleEvaluationDetail"},"description":"The detailed results of te evaluation"},"entity":{"type":"string","description":"An arbitrary user-supplied string that globally identifies the entity under evaluation"},"entity_metadata":{"type":"string","description":"Additional arbitrary user-supplied metadata about the entity under evaluation"},"id":{"type":"integer","description":"The ID of this evaluation","format":"int64"},"input":{"description":"The input provided at evaluation time"},"org_id":{"type":"string","description":"The Harness organisation in which the evaluation was performed"},"project_id":{"type":"string","description":"The Harness project in which the evaluation was performed"},"status":{"type":"string","description":"The overall status of the evaluation indicating whether it passed","enum":["error","warning","pass"]},"type":{"type":"string","description":"The types of the entity under evaluation"}},"description":"The result of a single evaluation","required":["id","status","entity","entity_metadata","type","action","account_id","org_id","project_id","created","input","details"]},"AnsibleEvaluationDetail":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy set","default":""},"action":{"type":"string","description":"Action that triggers the policy set","minLength":1},"created":{"type":"integer","description":"Time the policy set was created","format":"int64"},"description":{"type":"string","description":"Description of the policy set"},"details":{"type":"array","items":{"$ref":"#/components/schemas/AnsibleEvaluatedPolicy"}},"enabled":{"type":"boolean","description":"Only enabled policy sets are evaluated when evaluating by type/action"},"identifier":{"type":"string","description":"Identifier of the policy set","minLength":1},"name":{"type":"string","description":"Name of the policy set","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy set","default":""},"project_id":{"type":"string","description":"Harness project ID associated with this policy set","default":""},"status":{"type":"string","description":"The overall status for this policy set indicating whether it passed","enum":["error","warning","pass"]},"type":{"type":"string","description":"Type of input suitable for the policy set","minLength":1},"updated":{"type":"integer","description":"Time the policy set was last updated","format":"int64"}},"required":["status","details","identifier","name","action","type","enabled","created","updated","account_id","org_id","project_id","entity_selector"]},"AnsibleEvaluatedPolicy":{"type":"object","properties":{"deny_messages":{"type":"array","items":{"type":"string"},"description":"The values of any `deny` rego rules as returned by the rego engine"},"output":{"description":"The output returned by the rego engine when this policy was evaluated"},"policy":{"$ref":"#/components/schemas/Policy"},"rego_error":{"type":"string","description":"Any errors returned by the rego engine when this policy was evaluated"},"status":{"type":"string","description":"The overall status for this individual policy indicating whether it passed","enum":["error","warning","pass"]}},"required":["status","policy","output","deny_messages","rego_error"]},"Policy":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy","default":""},"created":{"type":"integer","description":"Time the policy was created","format":"int64"},"identifier":{"type":"string","description":"identifier of the policy","minLength":1},"name":{"type":"string","description":"Name of the policy","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy","default":""},"project_id":{"type":"string","description":"Harness project ID associated with this policy","default":""},"rego":{"type":"string","description":"Rego that defines the policy","minLength":1},"updated":{"type":"integer","description":"Time the policy was last updated","format":"int64"}},"required":["identifier","name","rego","created","updated","account_id","org_id","project_id"]},"AnsiblePolicyViolationError":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem."},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem."},"name":{"type":"string","description":"Name is the name of this class of errors."},"policy_evaluation":{"$ref":"#/components/schemas/AnsibleEvaluation"},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"required":["name","id","message","temporary","timeout","fault"]},"AnsibleError":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem."},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem."},"name":{"type":"string","description":"Name is the name of this class of errors."},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"required":["name","id","message","temporary","timeout","fault"]}}}}
```
