Create a Host for a Group
post
                    /api/v2/groups/{id}/hosts/
Make a POST request to this resource with the following host fields to create a new host associated with this group.
- name: Name of this host. (string, required)
- description: Optional description of this host. (string, default=- "")
- inventory: (id, required)
- enabled: Is this host online and available for running jobs? (boolean, default=- True)
- instance_id: The value used by the remote inventory source to uniquely identify the host (string, default=- "")
- variables: Host variables in JSON or YAML format. (json, default=``)
Add Hosts for a Group:
Make a POST request to this resource with only an id field to associate an
existing host with this group.
Remove Hosts from this Group:
Make a POST request to this resource with id and disassociate fields to
remove the host from this group
 without deleting the host.
Request
Supported Media Types
                - application/json
Path Parameters
                
                
                
                
                
                
                Root Schema : schema
    
      
        
      
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    Example:
    
    
{
    "id":1
}Response
Supported Media Types
                - application/json
201 Response
Example Response (application/json)
                    {
    "ansible_facts_modified":null,
    "created":"2018-02-01T08:00:00.000000Z",
    "description":"Hello world",
    "enabled":true,
    "has_active_failures":false,
    "has_inventory_sources":false,
    "id":1,
    "insights_system_id":null,
    "instance_id":"",
    "inventory":1,
    "last_job":null,
    "last_job_host_summary":null,
    "modified":"2018-02-01T08:00:00.000000Z",
    "name":"New name",
    "related":{
        "activity_stream":"/api/v2/hosts/1/activity_stream/",
        "ad_hoc_command_events":"/api/v2/hosts/1/ad_hoc_command_events/",
        "ad_hoc_commands":"/api/v2/hosts/1/ad_hoc_commands/",
        "all_groups":"/api/v2/hosts/1/all_groups/",
        "ansible_facts":"/api/v2/hosts/1/ansible_facts/",
        "groups":"/api/v2/hosts/1/groups/",
        "insights":"/api/v2/hosts/1/insights/",
        "inventory":"/api/v2/inventories/1/",
        "inventory_sources":"/api/v2/hosts/1/inventory_sources/",
        "job_events":"/api/v2/hosts/1/job_events/",
        "job_host_summaries":"/api/v2/hosts/1/job_host_summaries/",
        "smart_inventories":"/api/v2/hosts/1/smart_inventories/",
        "variable_data":"/api/v2/hosts/1/variable_data/"
    },
    "summary_fields":{
        "groups":{
            "count":0,
            "results":[
            ]
        },
        "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
        },
        "recent_jobs":[
        ],
        "user_capabilities":{
            "delete":true,
            "edit":true
        }
    },
    "type":"host",
    "url":"/api/v2/hosts/1/",
    "variables":""
}403 Response
Example Response (application/json)
                    {
    "detail":"You do not have permission to perform this action."
}