インベントリ・ソースの作成
post
/api/v2/inventory_sources/
次のインベントリ・ソース・フィールドを指定してこのリソースに対してPOSTリクエストを行って、新しいインベントリ・ソースを作成します。
name: このインベントリ・ソースの名前。(文字列、必須)description: このインベントリ・ソースのオプションの説明。(文字列、デフォルト="")source: (選択)file: ファイル、ディレクトリまたはスクリプトscm: プロジェクトからのソーシングec2: Amazon EC2gce: Google Compute Engineazure_rm: Microsoft Azure Resource Managervmware: VMware vCentersatellite6: Red Hat Satellite 6openstack: OpenStackrhv: Red Hat Virtualizationtower: Ansible Towercustom: カスタム・スクリプト
source_path: (文字列、デフォルト="")source_script: (id、デフォルト=``)source_vars: YAMLまたはJSON形式のインベントリ・ソース変数。(文字列、デフォルト="")credential: インベントリの更新に使用するクラウド資格証明。(整数、デフォルト=None)enabled_var: 対象となるホスト変数のディクショナリから有効状態を取得します。 有効化された変数は「foo.bar」のように指定でき、この場合は、ネストされた辞書を横断してルックアップが行われ、from_dict.get("foo", {}).get("bar", default) (文字列、デフォルト="")と同等になりますenabled_value: enabled_varが設定されている場合にのみ使用されます。 ホストが有効とみなされるときの値。 たとえば、enabled_var="status.power_state"およびenabled_value="powered_on"でホスト変数{ "status": { "power_state": "powered_on", "created": "2018-02-01T08:00:00.000000Z:00", "healthy": true }, "name": "foobar", "ip_address": "192.168.2.1"}を使用すると、ホストが有効とマークされます。 power_stateがpowered_on以外の値である場合、Towerにインポートされるときにホストは無効になります。 キーが見つからない場合、ホストは有効になります(文字列、デフォルト="")host_filter: 一致するホストのみがTowerにインポートされる正規表現。(文字列、デフォルト="")overwrite: リモート・インベントリ・ソースからローカル・グループおよびホストを上書きします。(ブール、デフォルト=False)overwrite_vars: リモート・インベントリ・ソースからローカル変数を上書きします。(ブール、デフォルト=False)custom_virtualenv: 使用するカスタムPython virtualenvを含むローカルの絶対ファイル・パス(文字列、デフォルト="")timeout: タスクが取り消されるまでの実行時間(秒)。(整数、デフォルト=0)-
verbosity: (選択)0: 0 (警告)1: 1 (情報) (デフォルト)2: 2 (デバッグ)
-
inventory: (id、必須) update_on_launch: (ブール、デフォルト=False)update_cache_timeout: (整数、デフォルト=0)source_project: ソースとして使用されるインベントリ・ファイルを含むプロジェクト。(id、デフォルト=``)update_on_project_update: (ブール、デフォルト=False)
リクエスト
サポートされているメディア・タイプ
- application/json
ルート・スキーマ : schema
例:
{
"credential":1,
"inventory":1,
"name":"fobar",
"source":"scm",
"source_path":"",
"source_project":1,
"source_vars":"plugin: a.b.c"
}レスポンス
サポートされているメディア・タイプ
- application/json
201レスポンス
レスポンスの例(application/json)
{
"created":"2018-02-01T08:00:00.000000Z",
"credential":1,
"custom_virtualenv":null,
"description":"",
"enabled_value":"",
"enabled_var":"",
"host_filter":"",
"id":2,
"inventory":1,
"last_job_failed":false,
"last_job_run":null,
"last_update_failed":false,
"last_updated":null,
"modified":"2018-02-01T08:00:00.000000Z",
"name":"fobar",
"next_job_run":null,
"overwrite":false,
"overwrite_vars":false,
"related":{
"activity_stream":"/api/v2/inventory_sources/2/activity_stream/",
"credential":"/api/v2/credentials/1/",
"credentials":"/api/v2/inventory_sources/2/credentials/",
"groups":"/api/v2/inventory_sources/2/groups/",
"hosts":"/api/v2/inventory_sources/2/hosts/",
"inventory":"/api/v2/inventories/1/",
"inventory_updates":"/api/v2/inventory_sources/2/inventory_updates/",
"notification_templates_error":"/api/v2/inventory_sources/2/notification_templates_error/",
"notification_templates_started":"/api/v2/inventory_sources/2/notification_templates_started/",
"notification_templates_success":"/api/v2/inventory_sources/2/notification_templates_success/",
"schedules":"/api/v2/inventory_sources/2/schedules/",
"source_project":"/api/v2/projects/1/",
"update":"/api/v2/inventory_sources/2/update/"
},
"source":"scm",
"source_path":"",
"source_project":1,
"source_script":null,
"source_vars":"plugin: a.b.c",
"status":"never updated",
"summary_fields":{
"credential":{
"cloud":true,
"credential_type_id":1,
"description":"",
"id":1,
"kind":"openstack",
"name":"bar"
},
"credentials":[
{
"cloud":true,
"credential_type_id":1,
"description":"",
"id":1,
"kind":"openstack",
"name":"bar"
}
],
"inventory":{
"description":"",
"has_active_failures":false,
"has_inventory_sources":true,
"hosts_with_active_failures":0,
"id":1,
"inventory_sources_with_failures":0,
"kind":"",
"name":"test-inv",
"organization_id":1,
"total_groups":0,
"total_hosts":0,
"total_inventory_sources":1
},
"organization":{
"description":"test-org-desc",
"id":1,
"name":"test-org"
},
"source_project":{
"description":"test-proj-desc",
"id":1,
"name":"test-proj",
"scm_type":"git",
"status":"never updated"
},
"user_capabilities":{
"delete":true,
"edit":true,
"schedule":true,
"start":true
}
},
"timeout":0,
"type":"inventory_source",
"update_cache_timeout":0,
"update_on_launch":false,
"update_on_project_update":false,
"url":"/api/v2/inventory_sources/2/",
"verbosity":1
}
400レスポンス
レスポンスの例(application/json)
{
"credential":[
"Credentials of type insights and vault are disallowed for scm inventory sources."
]
}