> 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/list-ansible-hosts.md).

# List Ansible Hosts

List all hosts across all inventories.

```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/hosts":{"get":{"tags":["ansible"],"summary":"List Ansible Hosts","description":"List all hosts across all inventories.","operationId":"ansible#list-hosts","parameters":[{"name":"limit","in":"query","description":"Limit is the number of records to return for a page.","allowEmptyValue":true,"schema":{"type":"integer","description":"Limit is the number of records to return for a page.","default":30,"format":"int64","minimum":1,"maximum":1000}},{"name":"page","in":"query","description":"Page is the page number to return relative to the page 'limit'.","allowEmptyValue":true,"schema":{"type":"integer","description":"Page is the page number to return relative to the page 'limit'.","default":1,"format":"int64","minimum":1}},{"name":"sort","in":"query","description":"Sort order for results","allowEmptyValue":true,"schema":{"type":"string","description":"Sort order for results","default":"host_address,ASC","enum":["host_address,ASC","host_address,DESC","updated,ASC","updated,DESC"]}},{"name":"searchTerm","in":"query","description":"Filter results by partial host address match","allowEmptyValue":true,"schema":{"type":"string","description":"Filter results by partial host address match","default":""}},{"name":"inventory","in":"query","description":"Filter results by inventory membership","allowEmptyValue":true,"schema":{"type":"string","description":"Filter results by inventory membership","default":""}},{"name":"status","in":"query","description":"Filter results by last activity status","allowEmptyValue":true,"schema":{"type":"string","description":"Filter results by last activity status","default":""}},{"name":"startTime","in":"query","description":"Filter results by last activity created time (Unix timestamp in milliseconds) - inclusive start of time range","allowEmptyValue":true,"schema":{"type":"integer","description":"Filter results by last activity created time (Unix timestamp in milliseconds) - inclusive start of time range","format":"int64"}},{"name":"endTime","in":"query","description":"Filter results by last activity created time (Unix timestamp in milliseconds) - inclusive end of time range","allowEmptyValue":true,"schema":{"type":"integer","description":"Filter results by last activity created time (Unix timestamp in milliseconds) - inclusive end of time range","format":"int64"}},{"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}}],"responses":{"200":{"description":"OK response.","headers":{},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HostResourceCollection"}}}},"400":{"description":"BadRequestError: Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/AnsibleError"}}}},"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":{"HostResourceCollection":{"type":"array","items":{"$ref":"#/components/schemas/HarnessIacmHost"}},"HarnessIacmHost":{"type":"object","properties":{"created":{"type":"integer","description":"Timestamp when the resource was created","format":"int64"},"host_address":{"type":"string","description":"The address of the host (hostname or IP)"},"id":{"type":"string","description":"The unique identifier for this host"},"inventories":{"type":"array","items":{"type":"string"},"description":"List of inventory identifiers this host belongs to"},"last_activity":{"$ref":"#/components/schemas/HostLastActivity"},"updated":{"type":"integer","description":"Timestamp when the resource was last updated","format":"int64"}},"required":["id","host_address","created","updated"]},"HostLastActivity":{"type":"object","properties":{"created":{"type":"integer","description":"Timestamp when the activity was created","format":"int64"},"playbooks":{"type":"array","items":{"type":"string"},"description":"Playbooks that were run in the last activity"},"status":{"type":"string","description":"Status of the last activity run on this host"}},"description":"HostLastActivity contains information about the most recent activity run on a host","required":["status","playbooks","created"]},"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"]}}}}
```
