インベントリの作成
post
/api/v2/inventories/
次のインベントリ・フィールドを指定してこのリソースに対してPOSTリクエストを行って、新しいインベントリを作成します。
name
: このインベントリの名前。(文字列、必須)description
: このインベントリのオプションの説明。(文字列、デフォルト=""
)organization
: このインベントリを含む組織。(id、必須)kind
: 表されているインベントリの種類。(選択)""
: ホストに、このインベントリへの直接リンクがあります。(デフォルト)smart
: host_filterプロパティを使用して生成されたインベントリのホスト。
host_filter
: このインベントリのホストに適用されるフィルタ。(文字列、デフォルト=""
)-
variables
: JSONまたはYAML形式のインベントリ変数。(json、デフォルト=``) -
insights_credential
: このインベントリに属するホストがRed Hat Insights APIにアクセスするときに使用する資格証明。(id、デフォルト=``)
リクエスト
サポートされているメディア・タイプ
- application/json
ルート・スキーマ : schema
例:
{
"host_filter":"ansible_facts__ansible_distribution__exact=\"CentOS\"",
"kind":"smart",
"name":"smart inventory",
"organization":1
}
レスポンス
サポートされているメディア・タイプ
- application/json
201レスポンス
レスポンスの例(application/json)
{
"created":"2018-02-01T08:00:00.000000Z",
"description":"",
"has_active_failures":false,
"has_inventory_sources":false,
"host_filter":"ansible_facts__ansible_distribution__exact=\"CentOS\"",
"hosts_with_active_failures":0,
"id":1,
"insights_credential":null,
"inventory_sources_with_failures":0,
"kind":"smart",
"modified":"2018-02-01T08:00:00.000000Z",
"name":"smart inventory",
"organization":1,
"pending_deletion":false,
"related":{
"access_list":"/api/v2/inventories/1/access_list/",
"activity_stream":"/api/v2/inventories/1/activity_stream/",
"ad_hoc_commands":"/api/v2/inventories/1/ad_hoc_commands/",
"copy":"/api/v2/inventories/1/copy/",
"groups":"/api/v2/inventories/1/groups/",
"hosts":"/api/v2/inventories/1/hosts/",
"instance_groups":"/api/v2/inventories/1/instance_groups/",
"inventory_sources":"/api/v2/inventories/1/inventory_sources/",
"job_templates":"/api/v2/inventories/1/job_templates/",
"object_roles":"/api/v2/inventories/1/object_roles/",
"organization":"/api/v2/organizations/1/",
"root_groups":"/api/v2/inventories/1/root_groups/",
"script":"/api/v2/inventories/1/script/",
"tree":"/api/v2/inventories/1/tree/",
"update_inventory_sources":"/api/v2/inventories/1/update_inventory_sources/",
"variable_data":"/api/v2/inventories/1/variable_data/"
},
"summary_fields":{
"object_roles":{
"adhoc_role":{
"description":"May run ad hoc commands on the inventory",
"id":17,
"name":"Ad Hoc"
},
"admin_role":{
"description":"Can manage all aspects of the inventory",
"id":15,
"name":"Admin"
},
"read_role":{
"description":"May view settings for the inventory",
"id":19,
"name":"Read"
},
"update_role":{
"description":"May update the inventory",
"id":16,
"name":"Update"
},
"use_role":{
"description":"Can use the inventory in a job template",
"id":18,
"name":"Use"
}
},
"organization":{
"description":"test-org-desc",
"id":1,
"name":"test-org"
},
"user_capabilities":{
"adhoc":true,
"copy":true,
"delete":true,
"edit":true
}
},
"total_groups":0,
"total_hosts":0,
"total_inventory_sources":0,
"type":"inventory",
"url":"/api/v2/inventories/1/",
"variables":""
}
400レスポンス
レスポンスの例(application/json)
{
"host_filter":{
"host_filter":[
"ansible_facts does not support searching with __has_keys"
]
}
}
403レスポンス
レスポンスの例(application/json)
{
"detail":"You do not have permission to perform this action."
}