Ensure the ACL is present

    name
        Specifies a human-friendly name for the ACL token.

    id
        Specifies the ID of the ACL.

    type: client
        Specifies the type of ACL token. Valid values are: client and management.

    rules
        Specifies rules for this ACL token.

    consul_url : http://locahost:8500
        consul URL to query

    .. note::
        For more information https://www.consul.io/api/acl.html#create-acl-token, https://www.consul.io/api/acl.html#update-acl-token

def acl_present(name, id=None, token=None, type="client", rules="", consul_url='http://localhost:8500'):
    '''
    Ensure the ACL is present

    name
        Specifies a human-friendly name for the ACL token.

    id
        Specifies the ID of the ACL.

    type: client
        Specifies the type of ACL token. Valid values are: client and management.

    rules
        Specifies rules for this ACL token.

    consul_url : http://locahost:8500
        consul URL to query

    .. note::
        For more information https://www.consul.io/api/acl.html#create-acl-token, https://www.consul.io/api/acl.html#update-acl-token
    '''

    ret = {
            'name': name,
            'changes': {},
            'result': True,
            'comment': 'ACL "{0}" exists and is up to date'.format(name)}

    exists = _acl_exists(name, id, token, consul_url)

    if not exists['result']:
        if __opts__['test']:
            ret['result'] = None
            ret['comment'] = "the acl doesn't exist, it will be created"
            return ret

        create = __salt__['consul.acl_create'](name=name, id=id, token=token, type=type, rules=rules, consul_url=consul_url)
        if create['res']:
            ret['result'] = True
            ret['comment'] = "the acl has been created"
        elif not create['res']:
            ret['result'] = False
            ret['comment'] = "failed to create the acl"
    elif exists['result']:
        changes = _acl_changes(name=name, id=exists['id'], token=token, type=type, rules=rules, consul_url=consul_url)
        if changes:
            if __opts__['test']:
                ret['result'] = None
                ret['comment'] = "the acl exists and will be updated"
                return ret

            update = __salt__['consul.acl_update'](name=name, id=exists['id'], token=token, type=type, rules=rules, consul_url=consul_url)
            if update['res']:
                ret['result'] = True
                ret['comment'] = "the acl has been updated"
            elif not update['res']:
                ret['result'] = False
                ret['comment'] = "failed to update the acl"

    return ret