Hi Dick,

Sorry for reverting for back late. Thanks a lot for the above sample. this 
really help me.

Regards
Amit

On Friday, May 14, 2021 at 9:39:27 PM UTC+5:30 [email protected] wrote:

> You can also first extract that number so you can use the standard >,
> < etc tests, for example:
>
> - set_fact:
> remaining_windows_rearm_count: "{{
> result.stdout_lines|regex_replace('.*Remaining Windows rearm count:
> (\\d+).*', '\\1' ) }}"
>
> - assert:
> that:
> - "'License Status: Licensed' in result.stdout_lines"
> - "'Product Key Channel: Volume:MAK'"
> - 2000 >= remaining_windows_rearm_count|int > 1000
> success_msg: "activated"
> fail_msg: "not activated"
>
>
> On Fri, 14 May 2021 at 17:47, Dick Visser <[email protected]> wrote:
> >
> > Adding this to the list of assertions will succeed for number between
> > 1000 and 1999:
> >
> > - "result.stdout_lines|regex_search('Remaining Windows rearm count: 
> 1\\d{3}')"
> >
> > Tweak the regex some more to include 2000 itself as well.
> >
> >
> >
> > On Fri, 14 May 2021 at 17:23, Amit Chettri <[email protected]> wrote:
> > >
> > > Hello,
> > >
> > > I am able to do the assert using basic string check. But i am looking 
> for a way to do using regex.
> > >
> > > example.
> > > i have register: result with below value
> > > "stdout_lines": [
> > > "microsoft (R) Windows Script Host Version 5.812",
> > > "Copyright (C) Microsoft Corporation. All rights reserved.",
> > > "Software licensing service version: 10.0.17763.107",
> > > "Name: Windows(R), ServerStandard edition",
> > > "Description: Windows(R) Operating System, VOLUME_MAK channel",
> > > "Activation ID: xxxxxxxx-e4b1-483b-81e8-xxxxxxx",
> > > "Application ID: xxxxxxx-d682-4d71-983e-xxxxxxx",
> > > "Extended PID: 03612-xxxxxx-071-xxxxxx-03-1033-1xxx7763.0000-xxxxx",
> > > "Product Key Channel: Volume:MAK",
> > > "Installation ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
> > > "Use License URL: 
> https://activation-ssssssssssssssss?configextension=Retail";,
> > > "Validation URL: 
> https://validation-v2.sls.microsoft.com/SLWGA/slwga.asmx";,
> > > "Partial Product Key: djkahdjka",
> > > "License Status: Licensed",
> > > "Remaining Windows rearm count: 1000",
> > > "Remaining SKU rearm count: 1001",
> > > "Trusted time: 5/13/2021 2:51:47 PM"
> > > ]
> > >
> > > using the code as below i am able to do the assert
> > > - assert:
> > > that:
> > > - "'License Status: Licensed' in result.stdout_lines"
> > > - "'Product Key Channel: Volume:MAK'"
> > > - "' Remaining Windows rearm count: 1000 ' in result.stdout_lines"
> > > success_msg: "activated"
> > > fail_msg: "not activated"
> > >
> > > My problem is that i "Remaining Windows rearm count" can be between 
> 1000-2000, do we have way to get this check as right now its static to 1000
> > >
> > > regards
> > > Amit
> > >
> > > --
> > > 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 [email protected].
> > > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/940bb086-cb7c-4cfc-907e-094c28e32cecn%40googlegroups.com
> .
> >
> >
> >
> > --
> > Dick Visser
> > Trust & Identity Service Operations Manager
> > GÉANT
>
>
>
> -- 
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9ab154b4-a50f-4fad-aed6-6d034db2cd9fn%40googlegroups.com.

Reply via email to