'run the idempotent ansible code'

@staticmethod
def run_ansible(params, check_mode):

    pconfig = PersistentVolumeClaimConfig(params['name'], params['namespace'], params['kubeconfig'], params['access_modes'], params['volume_capacity'], params['selector'], params['storage_class_name'])
    oc_pvc = OCPVC(pconfig, verbose=params['debug'])
    state = params['state']
    api_rval = oc_pvc.get()
    if (api_rval['returncode'] != 0):
        return {'failed': True, 'msg': api_rval}
    if (state == 'list'):
        return {'changed': False, 'results': api_rval['results'], 'state': state}
    if (state == 'absent'):
        if oc_pvc.exists():
            if check_mode:
                return {'changed': False, 'msg': 'CHECK_MODE:    Would    have    performed    a    delete.'}
            api_rval = oc_pvc.delete()
            if (api_rval['returncode'] != 0):
                return {'failed': True, 'msg': api_rval}
            return {'changed': True, 'results': api_rval, 'state': state}
        return {'changed': False, 'state': state}
    if (state == 'present'):
        if (not oc_pvc.exists()):
            if check_mode:
                return {'changed': True, 'msg': 'CHECK_MODE:    Would    have    performed    a    create.'}
            api_rval = oc_pvc.create()
            if (api_rval['returncode'] != 0):
                return {'failed': True, 'msg': api_rval}
            api_rval = oc_pvc.get()
            if (api_rval['returncode'] != 0):
                return {'failed': True, 'msg': api_rval}
            return {'changed': True, 'results': api_rval, 'state': state}
        if (oc_pvc.pvc.is_bound() or oc_pvc.pvc.get_volume_name()):
            api_rval['msg'] = '#####    -    This    volume    is    currently    bound.        Will    not    update    -    ####'
            return {'changed': False, 'results': api_rval, 'state': state}
        if oc_pvc.needs_update():
            api_rval = oc_pvc.update()
            if (api_rval['returncode'] != 0):
                return {'failed': True, 'msg': api_rval}
            api_rval = oc_pvc.get()
            if (api_rval['returncode'] != 0):
                return {'failed': True, 'msg': api_rval}
            return {'changed': True, 'results': api_rval, 'state': state}
        return {'changed': False, 'results': api_rval, 'state': state}
    return {'failed': True, 'msg': 'Unknown    state    passed.    {}'.format(state)}
