The output of ‘sh run | i boot’ shows 2 boot statements set in router. But i need to write a script which will check if ‘…9.16.12.04.SPA.bin’ is present specifically in 1st line followed by ‘…9.16.06.04.SPA.bin’ specifically in 2nd line.
I know to write a script to check if both these lines are persent or not. But my challenge is that i need to check if ‘…9.16.12.04.SPA.bin’ is present specifically in 1st line and so on. How do i do that?
ROUTER#sh run | i bootboot system flash bootflash:isr4300-universalk9.16.12.04.SPA.bin boot system flash bootflash:isr4300-universalk9.16.06.04.SPA.bin
Not sure if i misunderstood your suggestion but iam already aware of regex_search but does it help with specificaly ensuring that ‘…9.16.12.04.SPA.bin’ is present specifically in 1st line followed by ‘…9.16.06.04.SPA.bin’ specifically in 2nd line like in below output?
ROUTER#sh run | i boot
boot system flash bootflash:isr4300-universalk9.16.12.04.SPA.bin
boot system flash bootflash:isr4300-universalk9.16.06.04.SPA.bin
Reason for this question is even when i give ‘no boot’ first and then add boot statement in correct order, the lines interchage in rare cases when i check boot statement. Which means the router will boot up with old image rather than new image after reload since that comes in 1st line.
I went through example in ansible documentation but was not descriptive enough and searched extensively on internet but didn’t find any examples for multiline for ansible.
ROUTER#sh run | i boot
boot system flash bootflash:isr4300-universalk9.16.12.04.SPA.bin
boot system flash bootflash:isr4300-universalk9.16.06.04.SPA.bin
Below is a script i wrote using regex_search multiline for checking if ‘…9.16.12.04.SPA.bin’ is present specifically in 1st line followed by ‘…9.16.06.04.SPA.bin’ specifically in 2nd line. But doesn’t work. How should i modify it?
name: GATHER SHOW VERSION
ios_command:
commands: “sh run | i boot”