Documentation

14. Inventory Source List API Endpoint

Make a GET request to this resource to retrieve the list of inventory sources.

GET /api/v1/inventory_sources/
HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, HEAD, OPTIONS
X-API-Time: 0.053s

The resulting data structure contains:

{
    "count": 99,
    "next": null,
    "previous": null,
    "results": []
}

The count field indicates the total number of inventory sources found for the given query. The next and previous fields provides links to additional results if there are more than will fit on a single page. The results list contains zero or more inventory source records.

14.1. Results

Each inventory source data structure includes the following fields:

  • id: Database ID for this inventory source. (integer)
  • type: Data type for this inventory source. (multiple choice)
    • inventory_source: Inventory Source
  • url: URL for this inventory source. (string)
  • related: Data structure with URLs of related resources. (object)
  • summary_fields: Data structure with name/description for related resources. (object)
  • created: Timestamp when this inventory source was created. (datetime)
  • modified: Timestamp when this inventory source was last modified. (datetime)
  • name: (string)
  • description: (string)
  • source: (multiple choice)
    • "": Manual
    • file: Local File, Directory or Script
    • rax: Rackspace Cloud Servers
    • ec2: Amazon EC2
    • gce: Google Compute Engine
    • azure: Microsoft Azure
    • vmware: VMware vCenter
    • openstack: OpenStack
    • custom: Custom Script
  • source_path: (string)
  • source_script: (field)
  • source_vars: Inventory source variables in YAML or JSON format. (string)
  • credential: (field)
  • source_regions: (string)
  • instance_filters: Comma-separated list of filter expressions (EC2 only). Hosts are imported when ANY of the filters match. (string)
  • group_by: Limit groups automatically created from inventory source (EC2 only). (string)
  • overwrite: Overwrite local groups and hosts from remote inventory source. (boolean)
  • overwrite_vars: Overwrite local variables from remote inventory source. (boolean)
  • last_job_run: (datetime)
  • last_job_failed: (boolean)
  • has_schedules: (boolean)
  • next_job_run: (datetime)
  • status: (multiple choice)
    • new: New
    • pending: Pending
    • waiting: Waiting
    • running: Running
    • successful: Successful
    • failed: Failed
    • error: Error
    • canceled: Canceled
    • never updated: Never Updated
    • none: No External Source
  • inventory: (field)
  • group: (field)
  • update_on_launch: (boolean)
  • update_cache_timeout: (integer)
  • last_update_failed: (boolean)
  • last_updated: (datetime)

14.2. Reviewing the Options Endpoint

The Options Endpoint table offers a view of the Options for this endpoint. When viewing the endpoint in the browsable API, clicking the “Options” button gives you the raw JSON for the following:

name Inventory Source List
description # List Inventory Sources: Make a GET request to this resource to retrieve the list of inventory sources.
renders
0 application/json
1 text/html
parses
0 application/json
added_in_version 1.4
types
0 inventory_source
actions
GET
id
type integer
label ID
help_text Database ID for this inventory source.
type
type multiple choice
help_text Data type for this inventory source.
choices
0
0 inventory_source
1 Inventory Source
url
type string
help_text URL for this inventory source.
related
type object
help_text Data structure with URLs of related resources.
summary_fields
type object
help_text Data structure with name/description for related resources.
created
type datetime
help_text Timestamp when this inventory source was created.
modified
type datetime
help_text Timestamp when this inventory source was last modified.
name
type string
label name
description
type string
label description
source
type multiple choice
label source
choices
0
0 (Empty Text)
1 Manual
1
0 file
1 Local File, Directory or Script
2
0 rax
1 Rackspace Cloud Servers
3
0 ec2
1 Amazon EC2
4
0 gce
1 Google Compute Engine
5
0 azure
1 Microsoft Azure
6
0 vmware
1 VMware vCenter
7
0 openstack
1 OpenStack
8
0 custom
1 Custom Script
source_path
type string
label source path
source_script
type field
source_vars
type string
label source vars
help_text Inventory source variables in YAML or JSON format.
credential
type field
source_regions
type string
label source regions
azure_region_choices
0
0 all
1 All
1
0 Central_US
1 US Central
2
0 East_US_1
1 US East
3
0 East_US_2
1 US East 2
4
0 North_Central_US
1 US North Central
5
0 South_Central_US
1 US South Central
6
0 West_US
1 US West
7
0 North_Europe
1 Europe North
8
0 West_Europe
1 Europe West
9
0 East_Asia_Pacific
1 Asia Pacific East
10
0 Southest_Asia_Pacific
1 Asia Pacific Southeast
11
0 East_Japan
1 Japan East
12
0 West_Japan
1 Japan West
13
0 South_Brazil
1 Brazil South
ec2_region_choices
0
0 all
1 All
1
0 us-east-1
1 US East (Northern Virginia)
2
0 cn-north-1
1 China (Beijing)
3
0 ap-northeast-1
1 Asia Pacific (Tokyo)
4
0 eu-west-1
1 EU (Ireland)
5
0 ap-southeast-1
1 Asia Pacific (Singapore)
6
0 ap-southeast-2
1 Asia Pacific (Sydney)
7
0 us-west-2
1 US West (Oregon)
8
0 us-gov-west-1
1 US West (GovCloud)
9
0 us-west-1
1 US West (Northern California)
10
0 eu-central-1
1 EU (Frankfurt)
11
0 sa-east-1
1 South America (Sao Paulo)
gce_region_choices
0
0 all
1 All
1
0 us-central1-a
1 US Central (A)
2
0 us-central1-b
1 US Central (B)
3
0 us-central1-f
1 US Central (F)
4
0 europe-west1-a
1 Europe West (A)
5
0 europe-west1-b
1 Europe West (B)
6
0 asia-east1-a
1 Asia East (A)
7
0 asia-east1-b
1 Asia East (B)
rax_region_choices
0
0 ALL
1 All
1
0 ORD
1 Chicago
2
0 DFW
1 Dallas/Ft. Worth
3
0 IAD
1 Northern Virginia
4
0 LON
1 London
5
0 SYD
1 Sydney
6
0 HKG
1 Hong Kong
instance_filters
type string
label instance filters
help_text Comma-separated list of filter expressions (EC2 only). Hosts are imported when ANY of the filters match.
group_by
type string
label group by
help_text Limit groups automatically created from inventory source (EC2 only).
ec2_group_by_choices
0
0 availability_zone
1 Availability Zone
1
0 ami_id
1 Image ID
2
0 instance_id
1 Instance ID
3
0 instance_type
1 Instance Type
4
0 key_pair
1 Key Name
5
0 region
1 Region
6
0 security_group
1 Security Group
7
0 tag_keys
1 Tags
8
0 vpc_id
1 VPC ID
9
0 tag_none
1 Tag None
overwrite
type boolean
label overwrite
help_text Overwrite local groups and hosts from remote inventory source.
overwrite_vars
type boolean
label overwrite vars
help_text Overwrite local variables from remote inventory source.
last_job_run
type datetime
label last job run
last_job_failed
type boolean
label last job failed
has_schedules
type boolean
label has schedules
next_job_run
type datetime
label next job run
status
type multiple choice
choices
0
0 new
1 New
1
0 pending
1 Pending
2
0 waiting
1 Waiting
3
0 running
1 Running
4
0 successful
1 Successful
5
0 failed
1 Failed
6
0 error
1 Error
7
0 canceled
1 Canceled
8
0 never updated
1 Never Updated
9
0 none
1 No External Source
inventory
type field
group
type field
update_on_launch
type boolean
label update on launch
update_cache_timeout
type integer
label update cache timeout
last_update_failed
type boolean
last_updated
type datetime
search_fields
0 description
1 name