.. versionadded:: 2019.2.0

    Create a new device with a name, role, model, manufacturer and site.
    All these components need to be already in Netbox.

    name
        The name of the device, e.g., ``edge_router``
    role
        String of device role, e.g., ``router``
    model
        String of device model, e.g., ``MX480``
    manufacturer
        String of device manufacturer, e.g., ``Juniper``
    site
        String of device site, e.g., ``BRU``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_device edge_router router MX480 Juniper BRU

def create_device(name,
                  role,
                  model,
                  manufacturer,
                  site):
    '''
    .. versionadded:: 2019.2.0

    Create a new device with a name, role, model, manufacturer and site.
    All these components need to be already in Netbox.

    name
        The name of the device, e.g., ``edge_router``
    role
        String of device role, e.g., ``router``
    model
        String of device model, e.g., ``MX480``
    manufacturer
        String of device manufacturer, e.g., ``Juniper``
    site
        String of device site, e.g., ``BRU``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_device edge_router router MX480 Juniper BRU
    '''
    try:
        nb_role = get_('dcim', 'device-roles', name=role)
        if not nb_role:
            return False

        nb_type = get_('dcim', 'device-types', model=model)
        if not nb_type:
            return False
        nb_site = get_('dcim', 'sites', name=site)
        if not nb_site:
            return False

        status = {'label': "Active", 'value': 1}
    except RequestError as e:
        log.error('%s, %s, %s', e.req.request.headers, e.request_body, e.error)
        return False

    payload = {'name': name, 'display_name': name, 'slug': slugify(name), 'device_type': nb_type['id'],
               'device_role': nb_role['id'], 'site': nb_site['id']}
    new_dev = _add('dcim', 'devices', payload)
    if new_dev:
        return {'dcim': {'devices': payload}}
    else:
        return False