Hi @Dick Visser,
In my code, I wrote only for the state value, but I also wanted the
name value of the service.
I thought I would figure out the name part once I get the state part working.
My current status is
-----------------%<-----------------
debug:
msg: "{{ hello.results |
json_query('[?status.ActiveState!=`active`].{name: name, state:
status.ActiveState}') | to_nice_json }}"
-----------------%<-----------------
Thanks a lot.
---
Lee
On Tue, Dec 28, 2021 at 6:00 PM Dick Visser <[email protected]> wrote:
>
> I believe this is what you wanted - right?
>
> On Tue, 28 Dec 2021 at 12:58, Thomas Stephen Lee <[email protected]> wrote:
> >
> > Hi @Dick Visser,
> >
> > That gives the below output.
> >
> > -----------------%<-----------------
> >
> > TASK [debug]
> > *******************************************************************
> > ok: [localhost] => {
> > "hello|json_query('results[].status.ActiveState')": [
> > "active",
> > "active",
> > "active"
> > ]
> > }
> >
> > -----------------%<-----------------
> >
> > I will explore more, thanks a lot.
> >
> > ---
> > Lee
> >
> > On Tue, Dec 28, 2021 at 4:56 PM Dick Visser <[email protected]> wrote:
> > >
> > > I meant:
> > >
> > > - debug: var=hello|json_query('results[].status.ActiveState')
> > >
> > >
> > > On Tue, 28 Dec 2021 at 03:31, Thomas Stephen Lee <[email protected]>
> > > wrote:
> > > >
> > > > Hi @Dick Visser,
> > > >
> > > > That gives the below output.
> > > >
> > > > -----------------%<-----------------
> > > >
> > > > TASK [debug]
> > > > *******************************************************************
> > > > ok: [localhost] => {
> > > > "results|json_query('[].status.ActiveState')": ""
> > > > }
> > > >
> > > > -----------------%<-----------------
> > > >
> > > >
> > > > Thanks
> > > >
> > > > ---
> > > > Lee
> > > >
> > > > On Tue, Dec 28, 2021 at 1:37 AM Dick Visser <[email protected]>
> > > > wrote:
> > > > >
> > > > > On Mon, 27 Dec 2021 at 07:32, Thomas Stephen Lee <[email protected]>
> > > > > wrote:
> > > > >
> > > > > > - debug:
> > > > > > msg: "{{ hello.results | to_nice_json |
> > > > > > json_query('status.ActiveState') }}"
> > > > >
> > > > > the result var is a list, so if you want a list of a specific key:
> > > > >
> > > > >
> > > > > - debug: var=results|json_query('[].status.ActiveState')
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > 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/CAL8fbwNzq_4RhS4rtsTxHhWbPq8SRBMM3_1hpV30mHMFyp6sFA%40mail.gmail.com.
> > > >
> > > > --
> > > > 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/CAG7s96VGmsZ8OEhoNFtuEr4q1dmrK0pd6pKGpsspwCi4WQgjxg%40mail.gmail.com.
> > > >
> > >
> > >
> > > --
> > > 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/CAL8fbwOQZTegyfbzNwr1gZY0i_6g_4femX91-k7uAsqx3R8qGA%40mail.gmail.com.
> >
> > --
> > 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/CAG7s96VmOhOVO7xMdFGnZ_WnfeDZV36LwZNn1OLwG%2BVp%3Duhcqw%40mail.gmail.com.
> >
>
>
> --
> 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/CAL8fbwMn%2Bh%3D_f-aGUn9SmJCaYkKkjaKO6zN%2BJqN1gmWUcbAhWw%40mail.gmail.com.
--
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/CAG7s96XcQMshq7MsF8DJFrCJ0XE5e%3DBW_2AN1M7d9y1c13_qNg%40mail.gmail.com.