Forum Discussion
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.