Ansible Module bigip_device_info: what where they thinking
I was fiddeling around with ansible and wanted to build a playbook that triggers an HA-Sync, but only when there are pending changes (we don't use auto sync) and always sync from the active device to the group.
Sounded like a straight forward job and should be easy using the following F5 Ansible modules:
- bigip_device_info (for failover_state, device_groups name and sync_status)
- bigip_configsync_action (for triggering the sync)
But oh boy was I wrong. After debugging the JSON that was gathered by bigip_device_info I was pretty baffled, to be honest.
Why does every singel maschine return the info of every maschine of the HA cluster and also arrange alphabetically by hostname? Imagine you have a cluster consisting of two applinaces named "applianceA" and applianceB" and you query both devices for failover_state, you get the following:
Querying maschine "applianceA" for failover state:
access device_info.devices[0].failover_state = failover state of "applianceA"
access device_info.devices[1].failover_state = failover state of "applianceB"
Querying maschine "applianceB" for failover state:
access device_info.devices[0].failover_state = failover state of "applianceA"
access device_info.devices[1].failover_state = failover state of "applianceB"
This is in my opinion very pooly designed. I am expecting to get data from the particular device I am querying in the same excact location on every device. In this example one would have to first iterate over every item in the returend array, check if this is actually the data of the querried device and not it's HA partner. I don't think this is how ansible was supposed to work.
Or maybe I'm just stupid and don't know how it's done correctly?