code: def role_present(name, profile=None, **connection_args):
      ''''
      Ensures that the keystone role exists
  
      name
          The name of the role that should be present
      '''
      ret = {'name': name,
             'changes': {},
             'result': True,
             'comment': 'Role "{0}" already exists'.format(name)}
  
      # Check if role is already present
      role = __salt__['keystone.role_get'](name=name, profile=profile,
                                           **connection_args)
  
      if 'Error' not in role:
          return ret
      else:
          if __opts__.get('test'):
              ret['result'] = None
              ret['comment'] = 'Role "{0}" will be added'.format(name)
              return ret
          # Create role
          __salt__['keystone.role_create'](name, profile=profile,
                                           **connection_args)
          ret['comment'] = 'Role "{0}" has been added'.format(name)
          ret['changes']['Role'] = 'Created'
      return ref role_present(name, profile=None, **connection_args):
      ''''
      Ensures that the keystone role exists
  
      name
          The name of the role that should be present
      '''
      ret = {'name': name,
             'changes': {},
             'result': True,
             'comment': 'Role "{0}" already exists'.format(name)}
  
      # Check if role is already present
      role = __salt__['keystone.role_get'](name=name, profile=profile,
                                           **connection_args)
  
      if 'Error' not in role:
          return ret
      else:
          if __opts__.get('test'):
              ret['result'] = None
              ret['comment'] = 'Role "{0}" will be added'.format(name)
              return ret
          # Create role
          __salt__['keystone.role_create'](name, profile=profile,
                                           **connection_args)
          ret['comment'] = 'Role "{0}" has been added'.format(name)
          ret['changes']['Role'] = 'Created'
      return ret
docs: Ensures that the keystone role exists
  
      name
          The name of the role that should be present