def set_hostname(hostname=None):
    '''
    Sets the hostname on the server.

    .. versionadded:: 2019.2.0

    Args:
        hostname(str): The new hostname to set.

    CLI Example:

    .. code-block:: bash

        salt '*' cimc.set_hostname foobar

    '''
    if not hostname:
        raise salt.exceptions.CommandExecutionError("Hostname option must be provided.")

    dn = "sys/rack-unit-1/mgmt/if-1"
    inconfig = """<mgmtIf dn="sys/rack-unit-1/mgmt/if-1" hostname="{0}" ></mgmtIf>""".format(hostname)

    ret = __proxy__['cimc.set_config_modify'](dn, inconfig, False)

    try:
        if ret['outConfig']['mgmtIf'][0]['status'] == 'modified':
            return True
        else:
            return False
    except Exception as err:
        return False