17-Mar-2023 08:10
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
21-Mar-2023 13:50 - edited 21-Mar-2023 13:50
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.