Create an Ad Hoc Command for an Inventory
post
                    /api/v2/inventories/{id}/ad_hoc_commands/
Make a POST request to this resource with the following ad hoc command fields to create a new ad hoc command associated with this inventory.
- 
job_type: (choice)- run: Run (default)
- check: Check
 
- 
limit: (string, default="")
- credential: (id, default=``)
- module_name: (choice)- command(default)
- 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: (string, default=- "")
- forks: (integer, default=- 0)
- verbosity: (choice)- 0: 0 (Normal) (default)
- 1: 1 (Verbose)
- 2: 2 (More Verbose)
- 3: 3 (Debug)
- 4: 4 (Connection Debug)
- 5: 5 (WinRM Debug)
 
- extra_vars: (string, default=- "")
- become_enabled: (boolean, default=- False)
- diff_mode: (boolean, default=- False)
Request
Supported Media Types
                - application/json
Path Parameters
                
                
                
                
                
                
                Root Schema : schema
    
      
        
      
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    Example:
    
    
{
    "credential":1,
    "inventory":1,
    "module_args":"uptime",
    "module_name":"command"
}Response
Supported Media Types
                - application/json
201 Response
Example Response (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":1,
    "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/1/",
        "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":1,
            "inventory_sources_with_failures":0,
            "kind":"",
            "name":"test-inv",
            "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
}