'run the ansible idempotent code'

@staticmethod
def run_ansible(params, check_mode):

    sconfig = ServiceAccountConfig(params['service_account'], params['namespace'], params['kubeconfig'], [params['secret']], None)
    oc_sa_sec = OCServiceAccountSecret(sconfig, verbose=params['debug'])
    state = params['state']
    api_rval = oc_sa_sec.get()
    if (state == 'list'):
        return {'changed': False, 'results': api_rval['results'], 'state': 'list'}
    if (state == 'absent'):
        if oc_sa_sec.exists(params['secret']):
            if check_mode:
                return {'changed': True, 'msg': 'Would    have    removed    the    "    +                                                                                                                    "secret    from    the    service    account.'}
            api_rval = oc_sa_sec.delete()
            return {'changed': True, 'results': api_rval, 'state': 'absent'}
        return {'changed': False, 'state': 'absent'}
    if (state == 'present'):
        if (not oc_sa_sec.exists(params['secret'])):
            if check_mode:
                return {'changed': True, 'msg': ('Would    have    added    the    ' + 'secret    to    the    service    account.')}
            api_rval = oc_sa_sec.put()
            if (api_rval['returncode'] != 0):
                return {'failed': True, 'msg': api_rval}
            api_rval = oc_sa_sec.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'}
