Forum Discussion
Checking Image versions on multiple F5 Devices
Dear all,
I am wondering how I can check image versions without login into all devices?
We are planing an upgrade and the task is to check if there consistent images on all ?
Thanks in advance
- Lee_Sutcliffe
Nacreous
You could write a script that uses the REST API:
curl -X GET -u admin:admin -k "https://10.0.0.1/mgmt/tm/sys/version"
- BabaG
Nimbostratus
Many thanks Lee,
I will have to for a crash course on REST, I presume
Do you know or have any materials on REST, to narrow the search down ?
I was thinking if there is anything within F5 or its views that can be query and produce a reports
Regards
- jaikumar_f5
Noctilucent
Hi BabaG,
If you have a jump server, the job is easier.
Requirements:
- Jump Server having reachability to all your remote F5 servers.
- Have the passwordless login set up if not done already. You can refer internet on how to have passwordless login from a particular account. Or worst case, have a sshpass method used.
- A bash script.
- A list of F5 servers.
Create a simple bash script like below in your Jump server, lets say we name it version-script.
Paste the below code in the version-script. For now we have our scripts in /var/tmp/.
Jumpserver# vi version-script
#!/usr/bin/bash version="$(cat /VERSION | grep Version)" echo $HOSTNAME,$version
Have a list of servers added in the file - /var/tmp/serverlist.txt.
Now comes the execution part for multiple devices, I've put root user assuming you have the root's key already exchanged for passwordless login. You can change accordingly.
Create the executable script, named as run-script. Paste the below code in the run-script.
Jumpserver# vi run-script
echo "HOSTNAME,Version" > /var/tmp/F5-version-report.csv for i in `cat /var/tmp/serverlist.txt`; do ssh root@$i "-o StrictHostKeyChecking=no" "bash -s" < ./version-script >> /var/tmp/F5-version-report.csv done
All set and done, Just have the script executed (run-script).
bash run-script
Your outputs will be saved in /var/tmp/ location with the file named F5-version-report.csv. The good part is, its in csv format, so you can simply open in the excel sheet and use it for audit purpose.
- BabaG
Nimbostratus
Many thanks for the solutions, I did not have access to jumpServer since, reason I haven't test the solutions or reply for the confirmation
I have now able to test and I can confirm it works as you have shown
Many thanks once again and appreciated greatly!!
Regards
Baba
- BabaG
Nimbostratus
Hello again,
Is there anyway I can just input password once and carry it to the end instead of entering password on every devices?
Regards
- jaikumar_f5
Noctilucent
Hi ,
I had this explained in this step,
Have the passwordless login set up if not done already. You can refer internet on how to have passwordless login from a particular account. Or worst case, have a sshpass method used.
You can google on how to use sshpass method. Its your call to put explictly or by using in a file.
sshpass -p 'secret-password'
echo "HOSTNAME,Version" > /var/tmp/F5-version-report.csv for i in `cat /var/tmp/serverlist.txt`; do sshpass -p 'secret-password' ssh root@$i "-o StrictHostKeyChecking=no" "bash -s" < ./version-script >> /var/tmp/F5-version-report.csv done
or write your password in a file, make it readable by the user (share proper privileges)
sshpass -f secretfile
echo "HOSTNAME,Version" > /var/tmp/F5-version-report.csv for i in `cat /var/tmp/serverlist.txt`; do sshpass -f secretfile root@$i "-o StrictHostKeyChecking=no" "bash -s" < ./version-script >> /var/tmp/F5-version-report.csv done
Hope this helps.
Mark the answer as solution provided if you find it as your solution 🙂
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