private void addDeleteKeytab(Cluster cluster,
                               Set<String> hostFilter,
                               String hostParamsJson,
                               CommandParams commandParameters,
                               OrderedRequestStageContainer stageContainer)
      throws AmbariException {

    // Filter out any hosts that have been removed
    Set<String> hostNames = (CollectionUtils.isEmpty(hostFilter))
        ? null
        : hostFilter.stream()
        .filter(hostname -> ambariManagementController.getClusters().hostExists(hostname))
        .collect(toSet());

    if(CollectionUtils.isNotEmpty(hostNames)) {
      Stage stage = createNewStage(stageContainer.getLastStageId(),
          cluster,
          stageContainer.getId(),
          "Delete Keytabs",
          commandParameters.asJson(),
          hostParamsJson);

      Map<String, String> requestParams = new HashMap<>();
      List<RequestResourceFilter> requestResourceFilters = new ArrayList<>();
      RequestResourceFilter reqResFilter = new RequestResourceFilter("KERBEROS", "KERBEROS_CLIENT", new ArrayList<>(hostNames));
      requestResourceFilters.add(reqResFilter);

      ActionExecutionContext actionExecContext = new ActionExecutionContext(
          cluster.getClusterName(),
          REMOVE_KEYTAB,
          requestResourceFilters,
          requestParams);
      customCommandExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage, requestParams, null);
      stageContainer.addStage(stage);
    }
  }
Creates and adds stages to the given stage container for deleting kerberos identities.
The service component that belongs to the identity doesn't need to be installed.
ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java