Forum Discussion
ml4den_387195
Mar 28, 2019Nimbostratus
How to address multiple BIG-IP servers in one Ansible task?
How to address multiple BIG-IP servers in one Ansible task?
Ansible noob here, I'm trying to automate the configuration of large numbers of pools (and other things) using Ansible.
I have a hosts ...
- Mar 28, 2019
Resolved: the answer is to use the "inventory_hostname" variable like this:
tasks: - name: Create app1 server pool bigip_pool: name: app1_pl monitors: "/Common/http" lb_method: round-robin password: "adminpassword" server: "{{inventory_hostname}}" user: "adminuser" validate_certs: no delegate_to: localhost
This will cause Ansible to loop through the servers in the inventory/hosts group that we pass it. In my case the group is called "f5lab".
Rico
Mar 28, 2019Cirrus
With Ansible, you can create an Inventory file that stores variables for use in your playbooks. As you can see in this guide, you can create this Inventory file and then specify the host group you want to run the tasks on in the playbook.
If you have any more questions, I am sure I can help.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects