アドホック・コマンドの作成
post
/api/v2/ad_hoc_commands/
次のアドホック・コマンド・フィールドを指定してこのリソースに対してPOSTリクエストを行って、新しいアドホック・コマンドを作成します。
job_type
: (選択)run
: 実行(デフォルト)check
: チェック
inventory
: (id、デフォルト=``)limit
: (文字列、デフォルト=""
)credential
: (id、デフォルト=``)module_name
: (選択)command
(デフォルト)shell
yum
apt
apt_key
apt_repository
apt_rpm
service
group
user
mount
ping
selinux
setup
win_ping
win_service
win_updates
win_group
win_user
module_args
: (文字列、デフォルト=""
)forks
: (整数、デフォルト=0
)verbosity
: (選択)0
: 0 (標準) (デフォルト)1
: 1 (詳細)2
: 2 (より詳細)3
: 3 (デバッグ)4
: 4 (接続デバッグ)5
: 5 (WinRMデバッグ)
extra_vars
: (文字列、デフォルト=""
)become_enabled
: (ブール、デフォルト=False
)diff_mode
: (ブール、デフォルト=False
)
リクエスト
サポートされているメディア・タイプ
- application/json
ルート・スキーマ : schema
例:
{
"credential":1,
"inventory":3,
"module_args":"uptime",
"module_name":"command"
}
レスポンス
サポートされているメディア・タイプ
- application/json
201レスポンス
レスポンスの例(application/json)
{
"become_enabled":false,
"canceled_on":null,
"controller_node":"",
"created":"2018-02-01T08:00:00.000000Z",
"credential":1,
"diff_mode":false,
"elapsed":0,
"execution_node":"",
"extra_vars":"",
"failed":false,
"finished":null,
"forks":0,
"id":2,
"inventory":3,
"job_explanation":"",
"job_type":"run",
"launch_type":"manual",
"limit":"",
"modified":"2018-02-01T08:00:00.000000Z",
"module_args":"uptime",
"module_name":"command",
"name":"command",
"related":{
"activity_stream":"/api/v2/ad_hoc_commands/2/activity_stream/",
"cancel":"/api/v2/ad_hoc_commands/2/cancel/",
"credential":"/api/v2/credentials/1/",
"events":"/api/v2/ad_hoc_commands/2/events/",
"inventory":"/api/v2/inventories/3/",
"notifications":"/api/v2/ad_hoc_commands/2/notifications/",
"relaunch":"/api/v2/ad_hoc_commands/2/relaunch/",
"stdout":"/api/v2/ad_hoc_commands/2/stdout/"
},
"started":null,
"status":"new",
"summary_fields":{
"credential":{
"cloud":false,
"credential_type_id":1,
"description":"",
"id":1,
"kind":"ssh",
"kubernetes":false,
"name":"machine-cred"
},
"inventory":{
"description":"",
"has_active_failures":false,
"has_inventory_sources":false,
"hosts_with_active_failures":0,
"id":3,
"inventory_sources_with_failures":0,
"kind":"",
"name":"inv2",
"organization_id":1,
"total_groups":0,
"total_hosts":0,
"total_inventory_sources":0
},
"user_capabilities":{
"delete":true,
"start":true
}
},
"type":"ad_hoc_command",
"url":"/api/v2/ad_hoc_commands/2/",
"verbosity":0
}
400レスポンス
レスポンスの例(application/json)
{
"forks":[
"Ensure this value is greater than or equal to 0."
]
}
403レスポンス
レスポンスの例(application/json)
{
"detail":"You do not have permission to perform this action."
}