I just read the iRules 101 - 11 Events explanation and am excited about writing more modular iRules. What I am confused about though is how variables work across iRules within a virtual server. What I would like to accomplish is a set of generic rules which may be used in multiple VS's, plus one unique iRule for each VS that initializes the variables for that specific VS... so each VS's resources would look something like...
VS1 Resources:
vs1_config_irule
generic_http_https_redirect_irule
generic_authentication_irule
generic_cookie_persistence_irule
etc.
VS2 Resources:
vs2_config_irule
generic_http_https_redirect_irule
generic_authentication_irule
generic_cookie_persistence_irule
etc.
... and each VS's customization would not interfere with the others' nor require the generic iRules to be customized. Each generic iRule would get it's config from the config iRule assigned to the VS. I think this should be possible, but am confused about the scope of local and global variables, as well as which event block the variable initialization should be located (if in RULE_INIT then I assume it would affect all VS's, not just the one's the iRule is assigned to).