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

On Sunday, 11 April, 2021 at 7:01:54 pm UTC+5:30 Vikram S wrote:

> 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
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5a9f30ec-8f11-442e-b1de-8ac1fd83ff7cn%40googlegroups.com.

Reply via email to