I need to write a script to verify that boot statement is automatically set in ALL member switches of a stacked switch after this copying. But problem is i can easily write it when the boot statement is only 1 line. But when it is in multiple lines as below (3 boot statement for 3 member switches), thenhow can i verify that’flash:/c2960x-universalk9-mz.152-4.E7/c2960x-universalk9-mz.154-4.E4.bin’ exists on every line and not just in 1 or 2 lines?
Thanks for above config. But i feel above command may partially only solve my issue feel. I feel i didn’t frame the question properly to get the correct response.
I need to write a script to verify that boot statement is automatically set in ALL member switches of a stacked switch when doing post-copying verification.
But the problem is the script i know checks if boot statement for new image is set or not. It DOESN’T check if the boot statement is set for ALL member switches or not.
In other words, in below output, in case if new image is missing for 1 of the 3 member switches, how can i identify it using a script? Each switch may contain different number of stacked switch, so i may not be able to use pipe length parameter unles i included some conditional (which may make the script very lengthy)
I made a small modification to your suggestion and wrote the playbook in such a way that the number of boot statements set must match with numbr of stacked switches. This is to ensure that all stacked switches have boot statemtn set. However i am not getting the desired output. What am i doing wrong?
name: END THIS PLAYBOOK WHEN NO. OF BOOT STATEMENT DO NOT MATCH WITH NO. OF SWITCHES
meta: end_host
when: "{{ ‘show_switch’ | regex_findall(‘Switch’) | length }} != “{{ ‘show_boot’ | regex_findall(‘flash:/c2960x-universalk9-mz.154-4.E4.bin’) | length }}”