teach netscaler module about HA clusters

Netscaler appliances have the potential to be deployed in clusters for high availability - one node primary, one (or more) nodes secondary. Unfortunately this can lead to cases where a user (or ansible module) can log into a secondary node which may or may not be sending your configuration changes to the primary. No matter how many times you enable or disable a server or service, it ain’t happening.

However, help is at hand! The Netscaler Nitro API exposes, amongst other things, information about all the nodes in the HA cluster: their IP and whether they’re the active node or not.

So I propose modifying the netscaler module to expose an extra parameter called ‘cluster_aware’ or ‘resolve_active_node’ or something similar, which will enable the module to (upon every invocation and prior to executing the call specified by the module parameters)

    1. request the JSON-encoded parameters relating to the HA cluster (if any)
    1. check if the current netscaler is the primary
    1. if the current netscaler is not the primary, change the _nsc_host variable to the address of the primary
    1. carry out the request as normal.

Essentially what I’m proposing is the same kind of logic in the uri module for following HTTP redirects.

Thoughts?

-Howard