'perform the idempotent ansible logic'

@staticmethod
def run_ansible(params, check_mode):

    oc_scale = OCScale(params['name'], params['namespace'], params['replicas'], params['kind'], params['kubeconfig'], verbose=params['debug'])
    state = params['state']
    api_rval = oc_scale.get()
    if (api_rval['returncode'] != 0):
        return {'failed': True, 'msg': api_rval}
    if (state == 'list'):
        return {'changed': False, 'result': api_rval['results'], 'state': 'list'}
    elif (state == 'present'):
        if oc_scale.needs_update():
            if check_mode:
                return {'changed': True, 'result': 'CHECK_MODE:    Would    have    updated.'}
            api_rval = oc_scale.put()
            if (api_rval['returncode'] != 0):
                return {'failed': True, 'msg': api_rval}
            api_rval = oc_scale.get()
            if (api_rval['returncode'] != 0):
                return {'failed': True, 'msg': api_rval}
            return {'changed': True, 'result': api_rval['results'], 'state': 'present'}
        return {'changed': False, 'result': api_rval['results'], 'state': 'present'}
    return {'failed': True, 'msg': 'Unknown    state    passed.    [{}]'.format(state)}
