Re: [ansible-project] How to capture/filter stdout_lines

2019-04-11 Thread Saranya Nagaraj
Thankyou Sebastian

On Apr 10, 2019 11:16 AM, "Sebastian Meyer"  wrote:

> On 10.04.19 04:38, Saranya N wrote:
> > Stdout_lines that I get contains strings , json in different lines.
> >
> > I want to capture the last line and copy those contents to a a new Json
> file.
> >
> > How do I capture the last line from the registered variable.
> >
> > I tried this and it didn't work.
> >
> > "{{ Regvar.stdout_lines | last }}"
>
> Try
>
> {{ regvar.stdout_lines[-1] }}
>
> >
>
> --
> Sebastian Meyer
> Linux Consultant & Trainer
> Mail: me...@b1-systems.de
>
> B1 Systems GmbH
> Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
> GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPYop%2BjADFu4U8jYsFdsssywmdkc1%2B13PkkyLkhfzuTUwYZi-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to capture/filter stdout_lines

2019-04-09 Thread Sebastian Meyer
On 10.04.19 04:38, Saranya N wrote:
> Stdout_lines that I get contains strings , json in different lines.
> 
> I want to capture the last line and copy those contents to a a new Json file.
> 
> How do I capture the last line from the registered variable.
> 
> I tried this and it didn't work.
> 
> "{{ Regvar.stdout_lines | last }}"

Try

{{ regvar.stdout_lines[-1] }}

> 

-- 
Sebastian Meyer
Linux Consultant & Trainer
Mail: me...@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1fbac0ec-8f58-28f5-6d6f-27e0ac952a39%40b1-systems.de.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to capture/filter stdout_lines

2019-04-09 Thread Saranya N
To elaborate I don't want to use indeed value like sdout_lines[5] which works 
but is there a way to choose it by default ?

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/995fa403-a956-407f-abe4-c16da8e24a3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to capture/filter stdout_lines

2019-04-09 Thread Saranya N
Stdout_lines that I get contains strings , json in different lines.

I want to capture the last line and copy those contents to a a new Json file.

How do I capture the last line from the registered variable.

I tried this and it didn't work.

"{{ Regvar.stdout_lines | last }}"

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/35c5cc56-e7fe-40f9-b345-f56b00a994f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.