Forum Discussion
You may have already figured it out based on previous comments, but for posterity, below is an example of using the failover_state bigip fact as a condition for performing a task which is hopefully what you were after. The bigip_node task in this playbook contains a when statement so it only runs when the value of the failover_state fact is HA_STATE_ACTIVE; therefore, the task runs on the active device and not the standby. As you probably know if you create sync'able objects on all devices in the DG with a playbook you'll encounter a change conflict between the DG members. This playbook avoids that.
Update: Removing my example and instead pointing to:
K10531487: Running Ansible tasks on the active BIG-IP in a device group
Which AskF5 has published based on this Q&A. They've done this for other Q&As on DC as well.
This article contains more detailed instructions for creating this playbook and you can leave feedback at the bottom of the page.
I get an error when running this playbook. Error is "msg": "module (bigip_facts) is missing interpreter line". I'm using the bigip_facts.py from the f5-ansible repo on github