Previously, we discussed: Creating environment specific pre-conditions for job steps in Anthill Pro. Perhaps, you want to have job step preconditions based on agent filters, and not the environment shortname. If so, here’s an example of how that would go down. Let’s say you have a role in your farm called “weblogic-ejb” and you set an agent variable called “role” as “weblogic-ejb”. If you wanted to execute a job step only on servers of this role, you’d set a pre-condition step script as such:

Criteria myCriteria = new Criteria() {
public boolean matches(Object obj)
 throws Exception {
 return "weblogic-ejb".equalsIgnoreCase(AgentVarHelper.getCurrentAgentVar("role"));
 }
};

return Logic.and(
 StepStatus.priorIn(
  new JobStatusEnum[] { 
   JobStatusEnum.SUCCESS, 
   JobStatusEnum.SUCCESS_WARN,
   JobStatusEnum.NOT_NEEDED  
  }),
  myCriteria
 );

Again, we see here that our Logic.and() method ensures we have our agent filter set AND the previous jobs that were run were successful or not needed, which is just as important.