Forum Discussion
Run Ansible Playbook based on the Redundancy State.
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 see what your saying but I don't understand why is doing this. It's looking for the module in "Using module file /media/sf_f5_ansible_modules/f5_playbooks/bigip_facts.yml" but this is not the module file and the directory for the module in my ansible.cfg is /media/sf_f5_ansible_modules. Can you explained why this might be happening?
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com