void addCheckMissingKeytabsStage(Cluster cluster, String clusterHostInfoJson,
                                     String hostParamsJson, Map<String, String> commandParameters,
                                     RoleCommandOrder roleCommandOrder,
                                     RequestStageContainer requestStageContainer,
                                     List<String> hostsToInclude)
      throws AmbariException {
      Stage stage = createNewStage(requestStageContainer.getLastStageId(),
        cluster,
        requestStageContainer.getId(),
        "Checking keytabs",
        StageUtils.getGson().toJson(commandParameters),
        hostParamsJson);

      if (!hostsToInclude.isEmpty()) {
        Map<String, String> requestParams = new HashMap<>();

        ActionExecutionContext actionExecContext = createActionExecutionContext(
            cluster.getClusterName(),
            CHECK_KEYTABS,
            createRequestResourceFilters(hostsToInclude),
            requestParams,
            retryAllowed);

        customCommandExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage, requestParams, null);
      }
      RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
      roleGraph.build(stage);

      requestStageContainer.addStages(roleGraph.getStages());
    }
Send a custom command to the KERBEROS_CLIENT to check if there are missing keytabs on each hosts.
ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java