'run the ansible idempotent code'

@staticmethod
def run_ansible(params, check_mode):

    rconfig = StorageClassConfig(params['name'], provisioner='kubernetes.io/{}'.format(params['provisioner']), parameters=params['parameters'], annotations=params['annotations'], api_version='storage.k8s.io/{}'.format(params['api_version']), default_storage_class=params.get('default_storage_class', 'false'), kubeconfig=params['kubeconfig'])
    oc_sc = OCStorageClass(rconfig, verbose=params['debug'])
    state = params['state']
    api_rval = oc_sc.get()
    if (state == 'list'):
        return {'changed': False, 'results': api_rval['results'], 'state': 'list'}
    if (state == 'absent'):
        if oc_sc.exists():
            if check_mode:
                return {'changed': True, 'msg': 'Would    have    performed    a    delete.'}
            api_rval = oc_sc.delete()
            return {'changed': True, 'results': api_rval, 'state': 'absent'}
        return {'changed': False, 'state': 'absent'}
    if (state == 'present'):
        if (not oc_sc.exists()):
            if check_mode:
                return {'changed': True, 'msg': 'Would    have    performed    a    create.'}
            api_rval = oc_sc.create()
            if (api_rval['returncode'] != 0):
                return {'failed': True, 'msg': api_rval}
            api_rval = oc_sc.get()
            if (api_rval['returncode'] != 0):
                return {'failed': True, 'msg': api_rval}
            return {'changed': True, 'results': api_rval, 'state': 'present'}
        if oc_sc.needs_update():
            api_rval = oc_sc.update()
            if (api_rval['returncode'] != 0):
                return {'failed': True, 'msg': api_rval}
            api_rval = oc_sc.get()
            if (api_rval['returncode'] != 0):
                return {'failed': True, 'msg': api_rval}
            return {'changed': True, 'results': api_rval, 'state': 'present'}
        return {'changed': False, 'results': api_rval, 'state': 'present'}
    return {'failed': True, 'changed': False, 'msg': ('Unknown    state    passed.    %s' % state), 'state': 'unknown'}
