Need assistance in using 'OR' condition with regex_findall

Hi,

Below condition in statement 1 and 2 checks the number of boot statement set in switch matches with number of member switches available to ensure that correct boot statement is set for every member switch. Both statement 1 and 2 work when i give them individually.
But they fail when i use to it in assert statement as ‘OR’ conditional. How should i modify the syntax to make it work?

Statament 1:
show_boot_new.stdout[0] | regex_findall(‘BOOT variable = flash:packages.conf’) | length == show_switch.stdout[0] | regex_findall(‘Ready’) | length

Statement 2:
show_boot_new.stdout[0] | regex_findall(‘BOOT variable = flash:cat3k_caa-universalk9.16.09.06.SPA.conf’) | length == show_switch.stdout[0] | regex_findall(‘Ready’) | length

  • assert:
    that:
  • show_boot_new.stdout[0] | regex_findall(‘BOOT variable = flash:packages.conf’) | length == show_switch.stdout[0] | regex_findall(‘Ready’) | length or
    show_boot_new.stdout[0] | regex_findall(‘BOOT variable = flash:cat3k_caa-universalk9.16.09.06.SPA.conf’) | length == show_switch.stdout[0] | regex_findall(‘Ready’) | length
    fail_msg: “BOOT STATEMENT IS NOT SET FOR ALL MEMBERS SWITCHES. PLAYBOOK IS ENDING FOR HOST.”
    success_msg: “BOOT STATEMENT IS SET FOR ALL MEMBER SWITCHES”

Thanks,
Vikram

1 more update:

i tried the ‘OR’ conditional in several different formats as given in ansible documentation but nothing works. Let me know if you know of a syntax that can make OR condition to work withj regex_findall as given above.

Thanks,
Vikram