Forum Discussion
Thiyagu
Mar 17, 2023Cirrus
Need help with Ansible to ping multiple VIP IPs
Hello All, I'm working on Ansible script to ping the the F5 VIP IPs. Could you please share if anybody has worked on similar script for pinging LB VIPs? Thanks, Thiyagu
JRahm
Mar 21, 2023Admin
Hi Thiyagu, I asked chatGPT about that (I don't do a lot with ansible personally) and got this back, perhaps this will get you started:
---
- name: Ping all virtual servers on F5 BIG-IP
hosts: bigip
gather_facts: no
tasks:
- name: Get virtual server addrs
bigip_device_info:
gather_subset:
- virtual-addresses
register: vs_addrs
- name: Ping virtual servers
ping:
with_items: "{{ vs_addr['virtual_address'] }}"
when: item['enabled'] == True
loop_control:
label: "{{ item['address'] }}"
You might need to tweak/tune (as I did a little to update, the chatGPT provide _facts module has been deprecated in favor of the _info one, and you don't need all the virtual-server data, just the addresses, so I swapped that out too.
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