Re: [ansible-project] Stripping YAML dashes from output

2020-11-16 Thread lift...@gmail.com
Worked exactly as I wanted/needed!  Great tip!  I thank everyone for their 
help on this!

Thanks,
Harry

On Saturday, November 14, 2020 at 3:02:41 AM UTC-5 brae...@gmail.com wrote:

> On 11/14/20 12:05 AM, Dan Linder wrote:
> >> Ultimately I'd like to figure out how to add a semicolon after each 
> entry,
> > 
> > This should do that; join with a semicolon not a newline: | join('; ')
> > 
> >> then separate them into batches of 500 emails each
> > 
> > Since you have the list already, you could use a `for` loop with an `if` 
> test to insert a new-line to get the batches:
> > 
> > This should work assuming your full list of addresses is in 
> `list_of_addresses`:
> > {% for email_item in list_of_addresses %}{{ email_item }}{% if 
> loop.index is divisibleby 500 %}{{ '\n' -}}{% else %};{%
> > endif %}{% endfor %}
> > (note, all on one line)
> > 
> > All you need to do is replace the `list_of_addresses` with your YAML 
> list of addresses and you should get your list
> > broken into 500 element lines.
> > 
>
> That is indeed a nice piece of Jinja.
>
> Thanks, Dan!
>
> Regards
> Racke
>
> > You can check your Jinja syntax by using this site: 
> https://cryptic-cliffs-32040.herokuapp.com/
> > 
> > On Friday, November 13, 2020 at 11:51:32 AM UTC-6 lift...@gmail.com 
> wrote:
> > 
> > Perfect!  Exactly what I needed. Ultimately I'd like to figure out how 
> to add a semicolon after each entry, then
> > separate them into batches of 500 emails each, but I can worry about 
> that later. This works for now. 
> > 
> > Thanks 
> > Harry
> > 
> > On Fri, Nov 13, 2020, 12:44 PM Stefan Hornburg (Racke)  
> wrote:
> > 
> > On 11/13/20 6:28 PM, harry devine wrote:
> > > So how do I get rid of the u?  What I ultimately wanted was JUST the 
> email addresses. 
> > >
> > > Harry
> > 
> > Join the list members into a string: | join('\n')
> > 
> > Regards
> >  Racke
> > 
> > >
> > > On Fri, Nov 13, 2020, 12:15 PM Dick Visser  > wrote:
> > >
> > > This is a simple list, which is what you wanted.
> > >
> > > On Fri, 13 Nov 2020 at 17:28, lift...@gmail.com  lift...@gmail.com>  > > > wrote:
> > > >
> > > > So now I'm getting this:
> > > >
> > > > User Emails:
> > > >
> > > > Date generated: 11/13/2020 11:23:32
> > > > [u'us...@example.com ', 
> u'us...@example.com ']
> > > >
> > > > Harry
> > > >
> > > > On Friday, November 13, 2020 at 11:13:27 AM UTC-5 
> dick@geant.org  wrote:
> > > >>
> > > >> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com  lift...@gmail.com>  > > > wrote:
> > > >>
> > > >> >> >> >> > - name: Set User Email fact
> > > >> >> >> >> > set_fact:
> > > >> >> >> >> > user_list: "{{ user_find.json.result | 
> json_query('result[].mail') | list | to_nice_yaml }}"
> > > >>
> > > >> Try adding a pipe expression to the query, and leave out the
> > > >> 'list|to_nice_yaml':
> > > >>
> > > >>
> > > >> set_fact:
> > > >> user_list: "{{ user_find.json.result | 
> json_query('result[].mail[]') }}"
> > > >>
> > > >>
> > > >>
> > > >> Dick
> > > >
> > > > --
> > > > 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-proje...@googlegroups.com  ansible-project%2bunsu...@googlegroups.com>.
> > > > To view this discussion on the web visit
> > > 
> https://groups.google.com/d/msgid/ansible-project/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.com
> >
> > >   
> >  <
> https://groups.google.com/d/msgid/ansible-project/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.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
> > > ansible-proje...@googlegroups.com  ansible-project%2bunsu...@googlegroups.com>.
> > > To view this discussion on the web visit
> > >   
> >  
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%40mail.gmail.com
> >
> > >   
> >  <
> https://groups.google.com/d/ms

Re: [ansible-project] Stripping YAML dashes from output

2020-11-14 Thread Stefan Hornburg (Racke)
On 11/14/20 12:05 AM, Dan Linder wrote:
>> Ultimately I'd like to figure out how to add a semicolon after each entry,
> 
> This should do that; join with a semicolon not a newline: | join('; ')
> 
>> then separate them into batches of 500 emails each
> 
> Since you have the list already, you could use a `for` loop with an `if` test 
> to insert a new-line to get the batches:
> 
> This should work assuming your full list of addresses is in 
> `list_of_addresses`:
> {% for email_item in list_of_addresses %}{{ email_item }}{% if loop.index is 
> divisibleby 500 %}{{ '\n' -}}{% else %};{%
> endif %}{% endfor %}
> (note, all on one line)
> 
> All you need to do is replace the `list_of_addresses` with your YAML list of 
> addresses and you should get your list
> broken into 500 element lines.
> 

That is indeed a nice piece of Jinja.

Thanks, Dan!

Regards
Racke

> You can check your Jinja syntax by using this site: 
> https://cryptic-cliffs-32040.herokuapp.com/
> 
> On Friday, November 13, 2020 at 11:51:32 AM UTC-6 lift...@gmail.com wrote:
> 
> Perfect!  Exactly what I needed. Ultimately I'd like to figure out how to 
> add a semicolon after each entry, then
> separate them into batches of 500 emails each, but I can worry about that 
> later. This works for now. 
> 
> Thanks 
> Harry
> 
> On Fri, Nov 13, 2020, 12:44 PM Stefan Hornburg (Racke)  
> wrote:
> 
> On 11/13/20 6:28 PM, harry devine wrote:
> > So how do I get rid of the u?  What I ultimately wanted was JUST 
> the email addresses. 
> >
> > Harry
> 
> Join the list members into a string: | join('\n')
> 
> Regards
>          Racke
> 
> >
> > On Fri, Nov 13, 2020, 12:15 PM Dick Visser  > wrote:
> >
> >     This is a simple list, which is what you wanted.
> >
> >     On Fri, 13 Nov 2020 at 17:28, lift...@gmail.com 
>   >     > wrote:
> >     >
> >     > So now I'm getting this:
> >     >
> >     > User Emails:
> >     >
> >     > Date generated: 11/13/2020 11:23:32
> >     > [u'us...@example.com ', 
> u'us...@example.com ']
> >     >
> >     > Harry
> >     >
> >     > On Friday, November 13, 2020 at 11:13:27 AM UTC-5 
> dick@geant.org  wrote:
> >     >>
> >     >> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com 
>   >     > wrote:
> >     >>
> >     >> >> >> >> > - name: Set User Email fact
> >     >> >> >> >> > set_fact:
> >     >> >> >> >> > user_list: "{{ user_find.json.result | 
> json_query('result[].mail') | list | to_nice_yaml }}"
> >     >>
> >     >> Try adding a pipe expression to the query, and leave out the
> >     >> 'list|to_nice_yaml':
> >     >>
> >     >>
> >     >> set_fact:
> >     >> user_list: "{{ user_find.json.result | 
> json_query('result[].mail[]') }}"
> >     >>
> >     >>
> >     >>
> >     >> Dick
> >     >
> >     > --
> >     > 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-proje...@googlegroups.com 
> .
> >     > To view this discussion on the web visit
> >     
> https://groups.google.com/d/msgid/ansible-project/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.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
> >     ansible-proje...@googlegroups.com 
> .
> >     To view this discussion on the web visit
> >   
>  
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQML

Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Dan Linder
> Ultimately I'd like to figure out how to add a semicolon after each 
entry, 

This should do that; join with a semicolon not a newline: | join('; ') 

> then separate them into batches of 500 emails each 

Since you have the list already, you could use a `for` loop with an `if` 
test to insert a new-line to get the batches:

This should work assuming your full list of addresses is in `
list_of_addresses`:
{% for email_item in list_of_addresses %}{{ email_item }}{% if loop.index 
is divisibleby 500 %}{{ '\n' -}}{% else %};{% endif %}{% endfor %}
(note, all on one line)

All you need to do is replace the `list_of_addresses` with your YAML list 
of addresses and you should get your list broken into 500 element lines.

You can check your Jinja syntax by using this site: 
https://cryptic-cliffs-32040.herokuapp.com/
On Friday, November 13, 2020 at 11:51:32 AM UTC-6 lift...@gmail.com wrote:

> Perfect!  Exactly what I needed. Ultimately I'd like to figure out how to 
> add a semicolon after each entry, then separate them into batches of 500 
> emails each, but I can worry about that later. This works for now. 
>
> Thanks 
> Harry
>
> On Fri, Nov 13, 2020, 12:44 PM Stefan Hornburg (Racke)  
> wrote:
>
>> On 11/13/20 6:28 PM, harry devine wrote:
>> > So how do I get rid of the u?  What I ultimately wanted was JUST the 
>> email addresses. 
>> > 
>> > Harry 
>>
>> Join the list members into a string: | join('\n')
>>
>> Regards
>>  Racke
>>
>> > 
>> > On Fri, Nov 13, 2020, 12:15 PM Dick Visser > dick@geant.org>> wrote:
>> > 
>> > This is a simple list, which is what you wanted.
>> > 
>> > On Fri, 13 Nov 2020 at 17:28, lift...@gmail.com > lift...@gmail.com> > > > wrote:
>> > >
>> > > So now I'm getting this:
>> > >
>> > > User Emails:
>> > >
>> > > Date generated: 11/13/2020 11:23:32
>> > > [u'us...@example.com ', 
>> u'us...@example.com ']
>> > >
>> > > Harry
>> > >
>> > > On Friday, November 13, 2020 at 11:13:27 AM UTC-5 
>> dick@geant.org  wrote:
>> > >>
>> > >> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com > lift...@gmail.com> > > > wrote:
>> > >>
>> > >> >> >> >> > - name: Set User Email fact
>> > >> >> >> >> > set_fact:
>> > >> >> >> >> > user_list: "{{ user_find.json.result | 
>> json_query('result[].mail') | list | to_nice_yaml }}"
>> > >>
>> > >> Try adding a pipe expression to the query, and leave out the
>> > >> 'list|to_nice_yaml':
>> > >>
>> > >>
>> > >> set_fact:
>> > >> user_list: "{{ user_find.json.result | 
>> json_query('result[].mail[]') }}"
>> > >>
>> > >>
>> > >>
>> > >> Dick
>> > >
>> > > --
>> > > 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-proje...@googlegroups.com > ansible-project%2bunsu...@googlegroups.com>.
>> > > To view this discussion on the web visit
>> > 
>> https://groups.google.com/d/msgid/ansible-project/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.com
>> > <
>> https://groups.google.com/d/msgid/ansible-project/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.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
>> > ansible-proje...@googlegroups.com > ansible-project%2bunsu...@googlegroups.com>.
>> > To view this discussion on the web visit
>> > 
>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%40mail.gmail.com
>> > <
>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%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
>> > ansible-proje...@googlegroups.com > ansible-proje...@googlegroups.com>.
>> > To view this discussion on the web visit
>> > 
>> https://groups.google.com/d/msgid/ansible-project/CALYKJ268J-TnW1RGcahzQGfBeU9dHRRX_giohJ0%3DXuC9gfK-6A%40mail.gmail.com
>> > <
>> https://groups.google.com/d/msgid/ansible-project/CALYKJ268J-TnW1RGcahzQGfBeU9dHRRX_giohJ0%3DXuC9gfK-6A%40mail.gmail.com?utm_medium=email&utm_source=footer
>> >.
>>
>>
>> -- 
>> Ecommerce and Linux consulting + Perl and web application programming.
>> Debian and Sympa administration. Provisioning with Ansible.
>>
>> 

Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread harry devine
Perfect!  Exactly what I needed. Ultimately I'd like to figure out how to
add a semicolon after each entry, then separate them into batches of 500
emails each, but I can worry about that later. This works for now.

Thanks
Harry

On Fri, Nov 13, 2020, 12:44 PM Stefan Hornburg (Racke) 
wrote:

> On 11/13/20 6:28 PM, harry devine wrote:
> > So how do I get rid of the u?  What I ultimately wanted was JUST the
> email addresses.
> >
> > Harry
>
> Join the list members into a string: | join('\n')
>
> Regards
>  Racke
>
> >
> > On Fri, Nov 13, 2020, 12:15 PM Dick Visser  > wrote:
> >
> > This is a simple list, which is what you wanted.
> >
> > On Fri, 13 Nov 2020 at 17:28, lift...@gmail.com  lift...@gmail.com>  > > wrote:
> > >
> > > So now I'm getting this:
> > >
> > > User Emails:
> > >
> > > Date generated: 11/13/2020 11:23:32
> > > [u'us...@example.com ',
> u'us...@example.com ']
> > >
> > > Harry
> > >
> > > On Friday, November 13, 2020 at 11:13:27 AM UTC-5
> dick@geant.org  wrote:
> > >>
> > >> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com  lift...@gmail.com>  > > wrote:
> > >>
> > >> >> >> >> > - name: Set User Email fact
> > >> >> >> >> > set_fact:
> > >> >> >> >> > user_list: "{{ user_find.json.result |
> json_query('result[].mail') | list | to_nice_yaml }}"
> > >>
> > >> Try adding a pipe expression to the query, and leave out the
> > >> 'list|to_nice_yaml':
> > >>
> > >>
> > >> set_fact:
> > >> user_list: "{{ user_find.json.result |
> json_query('result[].mail[]') }}"
> > >>
> > >>
> > >>
> > >> Dick
> > >
> > > --
> > > 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  ansible-project%2bunsubscr...@googlegroups.com>.
> > > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.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
> > ansible-project+unsubscr...@googlegroups.com  ansible-project%2bunsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%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
> > ansible-project+unsubscr...@googlegroups.com  ansible-project+unsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/CALYKJ268J-TnW1RGcahzQGfBeU9dHRRX_giohJ0%3DXuC9gfK-6A%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/ansible-project/CALYKJ268J-TnW1RGcahzQGfBeU9dHRRX_giohJ0%3DXuC9gfK-6A%40mail.gmail.com?utm_medium=email&utm_source=footer
> >.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> 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/53e6fe8d-f14c-767f-51b6-de1445741d53%40linuxia.de
> .
>

-- 
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/CALYKJ256Y%2BM4-c6K%3D3aS5n9ThXriD-n0yHkhpLC2ojuBZ%2B_j9w%40mail.gmail.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Stefan Hornburg (Racke)
On 11/13/20 6:28 PM, harry devine wrote:
> So how do I get rid of the u?  What I ultimately wanted was JUST the email 
> addresses. 
> 
> Harry 

Join the list members into a string: | join('\n')

Regards
 Racke

> 
> On Fri, Nov 13, 2020, 12:15 PM Dick Visser  > wrote:
> 
> This is a simple list, which is what you wanted.
> 
> On Fri, 13 Nov 2020 at 17:28, lift...@gmail.com 
>   > wrote:
> >
> > So now I'm getting this:
> >
> > User Emails:
> >
> > Date generated: 11/13/2020 11:23:32
> > [u'us...@example.com ', 
> u'us...@example.com ']
> >
> > Harry
> >
> > On Friday, November 13, 2020 at 11:13:27 AM UTC-5 dick@geant.org 
>  wrote:
> >>
> >> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com 
>   > wrote:
> >>
> >> >> >> >> > - name: Set User Email fact
> >> >> >> >> > set_fact:
> >> >> >> >> > user_list: "{{ user_find.json.result | 
> json_query('result[].mail') | list | to_nice_yaml }}"
> >>
> >> Try adding a pipe expression to the query, and leave out the
> >> 'list|to_nice_yaml':
> >>
> >>
> >> set_fact:
> >> user_list: "{{ user_find.json.result | json_query('result[].mail[]') 
> }}"
> >>
> >>
> >>
> >> Dick
> >
> > --
> > 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/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.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
> ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%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
> ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CALYKJ268J-TnW1RGcahzQGfBeU9dHRRX_giohJ0%3DXuC9gfK-6A%40mail.gmail.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/53e6fe8d-f14c-767f-51b6-de1445741d53%40linuxia.de.


OpenPGP_0x5B93015BFA2720F8.asc
Description: application/pgp-keys


OpenPGP_signature
Description: OpenPGP digital signature


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread harry devine
So how do I get rid of the u?  What I ultimately wanted was JUST the email
addresses.

Harry

On Fri, Nov 13, 2020, 12:15 PM Dick Visser  wrote:

> This is a simple list, which is what you wanted.
>
> On Fri, 13 Nov 2020 at 17:28, lift...@gmail.com 
> wrote:
> >
> > So now I'm getting this:
> >
> > User Emails:
> >
> > Date generated: 11/13/2020 11:23:32
> > [u'us...@example.com', u'us...@example.com']
> >
> > Harry
> >
> > On Friday, November 13, 2020 at 11:13:27 AM UTC-5 dick@geant.org
> wrote:
> >>
> >> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com 
> wrote:
> >>
> >> >> >> >> > - name: Set User Email fact
> >> >> >> >> > set_fact:
> >> >> >> >> > user_list: "{{ user_find.json.result |
> json_query('result[].mail') | list | to_nice_yaml }}"
> >>
> >> Try adding a pipe expression to the query, and leave out the
> >> 'list|to_nice_yaml':
> >>
> >>
> >> set_fact:
> >> user_list: "{{ user_find.json.result | json_query('result[].mail[]') }}"
> >>
> >>
> >>
> >> Dick
> >
> > --
> > 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/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.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 ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALYKJ268J-TnW1RGcahzQGfBeU9dHRRX_giohJ0%3DXuC9gfK-6A%40mail.gmail.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Dick Visser
This is a simple list, which is what you wanted.

On Fri, 13 Nov 2020 at 17:28, lift...@gmail.com  wrote:
>
> So now I'm getting this:
>
> User Emails:
>
> Date generated: 11/13/2020 11:23:32
> [u'us...@example.com', u'us...@example.com']
>
> Harry
>
> On Friday, November 13, 2020 at 11:13:27 AM UTC-5 dick@geant.org wrote:
>>
>> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com  wrote:
>>
>> >> >> >> > - name: Set User Email fact
>> >> >> >> > set_fact:
>> >> >> >> > user_list: "{{ user_find.json.result | 
>> >> >> >> > json_query('result[].mail') | list | to_nice_yaml }}"
>>
>> Try adding a pipe expression to the query, and leave out the
>> 'list|to_nice_yaml':
>>
>>
>> set_fact:
>> user_list: "{{ user_find.json.result | json_query('result[].mail[]') }}"
>>
>>
>>
>> Dick
>
> --
> 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/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwMh9wong6MUnMHvZBs5AbpWogzD%3DYjQMLWOxNC0YebDEQ%40mail.gmail.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread lift...@gmail.com
So now I'm getting this:

User Emails:

Date generated: 11/13/2020 11:23:32
[u'us...@example.com', u'us...@example.com']

Harry

On Friday, November 13, 2020 at 11:13:27 AM UTC-5 dick@geant.org wrote:

> On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com  wrote:
>
> >> >> >> > - name: Set User Email fact
> >> >> >> > set_fact:
> >> >> >> > user_list: "{{ user_find.json.result | 
> json_query('result[].mail') | list | to_nice_yaml }}"
>
> Try adding a pipe expression to the query, and leave out the
> 'list|to_nice_yaml':
>
>
> set_fact:
> user_list: "{{ user_find.json.result | json_query('result[].mail[]') }}"
>
>
>
> Dick
>

-- 
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/e2de7a54-ba5d-4677-aaa6-9fd5cc83b522n%40googlegroups.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Dick Visser
On Fri, 13 Nov 2020 at 16:48, lift...@gmail.com  wrote:

>> >> >> > - name: Set User Email fact
>> >> >> > set_fact:
>> >> >> > user_list: "{{ user_find.json.result | json_query('result[].mail') | 
>> >> >> > list | to_nice_yaml }}"

Try adding a pipe expression to the query, and leave out the
'list|to_nice_yaml':


set_fact:
  user_list: "{{ user_find.json.result | json_query('result[].mail[]') }}"



Dick

-- 
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/CAL8fbwM7PnynvZyCCjN2-LLXmOJyevVUgwyBH_qgddbjfEUu1g%40mail.gmail.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread lift...@gmail.com
Hope this works and helps:

TASK [Print user_find] 
*
ok: [localhost] => {
"msg": {
"cache_control": "no-cache, private",
"changed": false,
"connection": "close",
"content_security_policy": "frame-ancestors 'none'",
"content_type": "application/json; charset=utf-8",
"cookies": {},
"cookies_string": "",
"date": "Fri, 13 Nov 2020 15:41:31 GMT",
"elapsed": 2,
"failed": false,
"json": {
"error": null,
"id": null,
"principal": "ad...@example.com",
"result": {
"count": 1822,
"result": [
{
"dn": 
"uid=user1,cn=users,cn=accounts,dc=example,dc=com",
"gidnumber": [
"1"
],
"givenname": [
"User1"
],
"homedirectory": [
"/home/user1"
],
"krbcanonicalname": [
"us...@example.com"
],
"krbprincipalname": [
"us...@example.com"
],
"loginshell": [
"/bin/bash"
],
"mail": [
"us...@example.com"
],
"nsaccountlock": false,
"sn": [
"User"
],
"telephonenumber": [
"(555) 555-"
],
"uid": [
"user1"
],
"uidnumber": [
""
]
},
{
"dn": 
"uid=user2,cn=users,cn=accounts,dc=example,dc=com",
"gidnumber": [
"1"
],
"givenname": [
"User2"
],
"homedirectory": [
"/home/user2"
],
"krbcanonicalname": [
"us...@example.com"
],
"krbprincipalname": [
"us...@example.com"
],
"loginshell": [
"/bin/bash"
],
"mail": [
"us...@example.com"
],
"nsaccountlock": false,
"sn": [
"User"
],
"telephonenumber": [
"(555)555-5556"
],
"uid": [
"user2"
],
"uidnumber": [
""
]
},
}
],
"summary": "1822 users matched",
"truncated": false
},
"version": "4.6.8"
},
"msg": "OK (unknown bytes)",
"redirected": false,
"server": "Apache/2.4.6 (Red Hat Enterprise Linux) 
mod_auth_gssapi/1.5.1 mod_nss/1.0.14 NSS/3.28.4 mod_wsgi/3.4 Python/2.7.5",
"status": 200,
"transfer_encoding": "chunked",
"url": "https://auth.example.com/ipa/session/json";,
"vary": "Accept-Encoding",
"x_frame_options": "DENY"
}
}

Thanks,
Harry

On Friday, November 13, 2020 at 8:56:46 AM UTC-5 dick@geant.org wrote:

> At least something that is valid json with at least two iterations
> should be welcome.
>
> On Fri, 13 Nov 2020 at 14:53, lift...@gmail.com  wrote:
> >
> > There are over 1800 users. That's alot of data for me to redact. How 
> much longer of a sample would you like to see?
> >
> > Harry
> >
> > On Friday, November 13, 2020 at 8:49:37 AM UTC-5 dick@geant.org 
> wrote:
> >>
> >> that appears to be mutilated, can you post a longer piece so the
> >> iteration structure is intact ?
> >>
> >> On Fri, 13 Nov 2020 at 13:53, lift...@gmail.com  
> wrote:
> >> >
> >> > Here's a subset of user_find.json.result:
> >> >
> >> > TASK [Print user_find] 
> *
> >> > ok: [localhost] 

Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Dick Visser
At least something that is valid json with at least two iterations
should be welcome.

On Fri, 13 Nov 2020 at 14:53, lift...@gmail.com  wrote:
>
> There are over 1800 users.  That's alot of data for me to redact.  How much 
> longer of a sample would you like to see?
>
> Harry
>
> On Friday, November 13, 2020 at 8:49:37 AM UTC-5 dick@geant.org wrote:
>>
>> that appears to be mutilated, can you post a longer piece so the
>> iteration structure is intact ?
>>
>> On Fri, 13 Nov 2020 at 13:53, lift...@gmail.com  wrote:
>> >
>> > Here's a subset of user_find.json.result:
>> >
>> > TASK [Print user_find] 
>> > *
>> > ok: [localhost] => {
>> > "msg": {
>> > "count": 1826,
>> > "result": [
>> > {
>> > "dn": "uid=harry.devine,cn=users,cn=example,dc=com",
>> > "gidnumber": [
>> > "9"
>> > ],
>> > "givenname": [
>> > "Harry"
>> > ],
>> > "homedirectory": [
>> > "/home/harry.devine"
>> > ],
>> > "krbcanonicalname": [
>> > "harry@example.com"
>> > ],
>> > "krbprincipalname": [
>> > "harry@example.com"
>> > ],
>> > "loginshell": [
>> > "/bin/bash"
>> > ],
>> > "mail": [
>> > "harry@example.com"
>> > ],
>> > "nsaccountlock": false,
>> > "sn": [
>> > "Devine"
>> > ],
>> > "telephonenumber": [
>> > "(609) 867-5309"
>> > ],
>> > "uid": [
>> > "harry.devine"
>> > ],
>> > "uidnumber": [
>> > "1000"
>> > ]
>> > },
>> > }
>> > ],
>> > "summary": "1826 users matched",
>> > "truncated": false
>> > }
>> >
>> > Thanks,
>> > Harry
>> >
>> > On Thursday, November 12, 2020 at 9:53:29 AM UTC-5 brae...@gmail.com wrote:
>> >>
>> >> On 11/12/20 3:49 PM, lift...@gmail.com wrote:
>> >> > I have a playbook where I am traversing our FreeIPA server and pulling 
>> >> > out each user's email address. I'm then putting
>> >> > that data into a text file using the template module:
>> >> >
>> >> > - name: Set User Email fact
>> >> > set_fact:
>> >> > user_list: "{{ user_find.json.result | json_query('result[].mail') | 
>> >> > list | to_nice_yaml }}"
>> >> >
>> >> > - name: Prepare report
>> >> > template:
>> >> > src: /root/emails.txt.j2
>> >> > dest: /root/emails.txt
>> >> > delegate_to: localhost
>> >> > run_once: true
>> >> >
>> >> > The j2 template:
>> >> >
>> >> > User Emails:
>> >> >
>> >> > Date generated: {{ now(false, '%m/%d/%Y %I:%M:%S') }}
>> >> > {{ user_list }}
>> >> >
>> >> > This returns the following in the text file:
>> >> >
>> >> > User Emails:
>> >> >
>> >> > Date generated: 11/12/2020 09:40:26
>> >> > - - us...@example.com
>> >> > - - us...@example.com
>> >> >
>> >> > How can I strip out the preceding dashes?
>> >>
>> >> Please post a sample of the JSON in user_find.json.result.
>> >>
>> >> Regards
>> >> Racke
>> >>
>> >> >
>> >> > Thanks,
>> >> > Harry
>> >> >
>> >> > --
>> >> > 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-proje...@googlegroups.com 
>> >> > .
>> >> > To view this discussion on the web visit
>> >> > https://groups.google.com/d/msgid/ansible-project/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.com
>> >> > .
>> >>
>> >>
>> >> --
>> >> Ecommerce and Linux consulting + Perl and web application programming.
>> >> Debian and Sympa administration. Provisioning with Ansible.
>> >
>> > --
>> > 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-proje...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/ansible-project/96c45ddc-3628-47a2-ad04-a899eb7d9f5dn%40googlegroups.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 ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/884028a3-6206-4b0c-859f-e9f17b49342en%40googlegroups.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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwOQr%2BTQDVurK3Q0XE-Qr5%3DJ1Of5MJ9EDknKpcwOWQZfhA%40m

Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread lift...@gmail.com
There are over 1800 users.  That's alot of data for me to redact.  How much 
longer of a sample would you like to see?

Harry

On Friday, November 13, 2020 at 8:49:37 AM UTC-5 dick@geant.org wrote:

> that appears to be mutilated, can you post a longer piece so the
> iteration structure is intact ?
>
> On Fri, 13 Nov 2020 at 13:53, lift...@gmail.com  wrote:
> >
> > Here's a subset of user_find.json.result:
> >
> > TASK [Print user_find] 
> *
> > ok: [localhost] => {
> > "msg": {
> > "count": 1826,
> > "result": [
> > {
> > "dn": "uid=harry.devine,cn=users,cn=example,dc=com",
> > "gidnumber": [
> > "9"
> > ],
> > "givenname": [
> > "Harry"
> > ],
> > "homedirectory": [
> > "/home/harry.devine"
> > ],
> > "krbcanonicalname": [
> > "harry@example.com"
> > ],
> > "krbprincipalname": [
> > "harry@example.com"
> > ],
> > "loginshell": [
> > "/bin/bash"
> > ],
> > "mail": [
> > "harry@example.com"
> > ],
> > "nsaccountlock": false,
> > "sn": [
> > "Devine"
> > ],
> > "telephonenumber": [
> > "(609) 867-5309"
> > ],
> > "uid": [
> > "harry.devine"
> > ],
> > "uidnumber": [
> > "1000"
> > ]
> > },
> > }
> > ],
> > "summary": "1826 users matched",
> > "truncated": false
> > }
> >
> > Thanks,
> > Harry
> >
> > On Thursday, November 12, 2020 at 9:53:29 AM UTC-5 brae...@gmail.com 
> wrote:
> >>
> >> On 11/12/20 3:49 PM, lift...@gmail.com wrote:
> >> > I have a playbook where I am traversing our FreeIPA server and 
> pulling out each user's email address. I'm then putting
> >> > that data into a text file using the template module:
> >> >
> >> > - name: Set User Email fact
> >> > set_fact:
> >> > user_list: "{{ user_find.json.result | json_query('result[].mail') | 
> list | to_nice_yaml }}"
> >> >
> >> > - name: Prepare report
> >> > template:
> >> > src: /root/emails.txt.j2
> >> > dest: /root/emails.txt
> >> > delegate_to: localhost
> >> > run_once: true
> >> >
> >> > The j2 template:
> >> >
> >> > User Emails:
> >> >
> >> > Date generated: {{ now(false, '%m/%d/%Y %I:%M:%S') }}
> >> > {{ user_list }}
> >> >
> >> > This returns the following in the text file:
> >> >
> >> > User Emails:
> >> >
> >> > Date generated: 11/12/2020 09:40:26
> >> > - - us...@example.com
> >> > - - us...@example.com
> >> >
> >> > How can I strip out the preceding dashes?
> >>
> >> Please post a sample of the JSON in user_find.json.result.
> >>
> >> Regards
> >> Racke
> >>
> >> >
> >> > Thanks,
> >> > Harry
> >> >
> >> > --
> >> > 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-proje...@googlegroups.com  ansible-proje...@googlegroups.com>.
> >> > To view this discussion on the web visit
> >> > 
> https://groups.google.com/d/msgid/ansible-project/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.com
> >> > <
> https://groups.google.com/d/msgid/ansible-project/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
> >>
> >>
> >> --
> >> Ecommerce and Linux consulting + Perl and web application programming.
> >> Debian and Sympa administration. Provisioning with Ansible.
> >
> > --
> > 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-proje...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/96c45ddc-3628-47a2-ad04-a899eb7d9f5dn%40googlegroups.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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/884028a3-6206-4b0c-859f-e9f17b49342en%40googlegroups.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Dick Visser
that appears to be mutilated, can you post a longer piece so the
iteration structure is intact ?

On Fri, 13 Nov 2020 at 13:53, lift...@gmail.com  wrote:
>
> Here's a subset of user_find.json.result:
>
> TASK [Print user_find] 
> *
> ok: [localhost] => {
> "msg": {
> "count": 1826,
> "result": [
> {
> "dn": "uid=harry.devine,cn=users,cn=example,dc=com",
> "gidnumber": [
> "9"
> ],
> "givenname": [
> "Harry"
> ],
> "homedirectory": [
> "/home/harry.devine"
> ],
> "krbcanonicalname": [
> "harry.dev...@example.com"
> ],
> "krbprincipalname": [
> "harry.dev...@example.com"
> ],
> "loginshell": [
> "/bin/bash"
> ],
> "mail": [
> "harry.dev...@example.com"
> ],
> "nsaccountlock": false,
> "sn": [
> "Devine"
> ],
> "telephonenumber": [
> "(609) 867-5309"
> ],
> "uid": [
> "harry.devine"
> ],
> "uidnumber": [
> "1000"
> ]
> },
>   }
> ],
> "summary": "1826 users matched",
> "truncated": false
> }
>
> Thanks,
> Harry
>
> On Thursday, November 12, 2020 at 9:53:29 AM UTC-5 brae...@gmail.com wrote:
>>
>> On 11/12/20 3:49 PM, lift...@gmail.com wrote:
>> > I have a playbook where I am traversing our FreeIPA server and pulling out 
>> > each user's email address.  I'm then putting
>> > that data into a text file using the template module:
>> >
>> >   - name: Set User Email fact
>> > set_fact:
>> >   user_list: "{{ user_find.json.result | json_query('result[].mail') | 
>> > list | to_nice_yaml }}"
>> >
>> >   - name: Prepare report
>> > template:
>> >   src: /root/emails.txt.j2
>> >   dest: /root/emails.txt
>> > delegate_to: localhost
>> > run_once: true
>> >
>> > The j2 template:
>> >
>> > User Emails:
>> >
>> > Date generated: {{ now(false, '%m/%d/%Y %I:%M:%S') }}
>> > {{ user_list }}
>> >
>> > This returns the following in the text file:
>> >
>> > User Emails:
>> >
>> > Date generated: 11/12/2020 09:40:26
>> > -   - us...@example.com
>> > -   - us...@example.com
>> >
>> > How can I strip out the preceding dashes?
>>
>> Please post a sample of the JSON in user_find.json.result.
>>
>> Regards
>> Racke
>>
>> >
>> > Thanks,
>> > Harry
>> >
>> > --
>> > 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-proje...@googlegroups.com 
>> > .
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msgid/ansible-project/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.com
>> > .
>>
>>
>> --
>> Ecommerce and Linux consulting + Perl and web application programming.
>> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> 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/96c45ddc-3628-47a2-ad04-a899eb7d9f5dn%40googlegroups.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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwNiXQp3%2BcUrcwGcT0DLUofZXv3JAiRKvo5cuz2A5-Gemw%40mail.gmail.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread lift...@gmail.com
Here's a subset of user_find.json.result:

TASK [Print user_find] 
*
ok: [localhost] => {
"msg": {
"count": 1826,
"result": [
{
"dn": "uid=harry.devine,cn=users,cn=example,dc=com",
"gidnumber": [
"9"
],
"givenname": [
"Harry"
],
"homedirectory": [
"/home/harry.devine"
],
"krbcanonicalname": [
"harry.dev...@example.com"
],
"krbprincipalname": [
"harry.dev...@example.com"
],
"loginshell": [
"/bin/bash"
],
"mail": [
"harry.dev...@example.com"
],
"nsaccountlock": false,
"sn": [
"Devine"
],
"telephonenumber": [
"(609) 867-5309"
],
"uid": [
"harry.devine"
],
"uidnumber": [
"1000"
]
},
  }
],
"summary": "1826 users matched",
"truncated": false
}

Thanks,
Harry

On Thursday, November 12, 2020 at 9:53:29 AM UTC-5 brae...@gmail.com wrote:

> On 11/12/20 3:49 PM, lift...@gmail.com wrote:
> > I have a playbook where I am traversing our FreeIPA server and pulling 
> out each user's email address.  I'm then putting
> > that data into a text file using the template module:
> > 
> >   - name: Set User Email fact
> > set_fact:
> >   user_list: "{{ user_find.json.result | json_query('result[].mail') 
> | list | to_nice_yaml }}"
> > 
> >   - name: Prepare report
> > template:
> >   src: /root/emails.txt.j2
> >   dest: /root/emails.txt
> > delegate_to: localhost
> > run_once: true
> > 
> > The j2 template:
> > 
> > User Emails:
> > 
> > Date generated: {{ now(false, '%m/%d/%Y %I:%M:%S') }}
> > {{ user_list }}
> > 
> > This returns the following in the text file:
> > 
> > User Emails:
> > 
> > Date generated: 11/12/2020 09:40:26
> > -   - us...@example.com
> > -   - us...@example.com
> > 
> > How can I strip out the preceding dashes?
>
> Please post a sample of the JSON in user_find.json.result.
>
> Regards
> Racke
>
> > 
> > Thanks,
> > Harry
> > 
> > -- 
> > 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-proje...@googlegroups.com  ansible-proje...@googlegroups.com>.
> > To view this discussion on the web visit
> > 
> https://groups.google.com/d/msgid/ansible-project/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
>
>
> -- 
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>

-- 
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/96c45ddc-3628-47a2-ad04-a899eb7d9f5dn%40googlegroups.com.


Re: [ansible-project] Stripping YAML dashes from output

2020-11-12 Thread Stefan Hornburg (Racke)
On 11/12/20 3:49 PM, lift...@gmail.com wrote:
> I have a playbook where I am traversing our FreeIPA server and pulling out 
> each user's email address.  I'm then putting
> that data into a text file using the template module:
> 
>   - name: Set User Email fact
>     set_fact:
>       user_list: "{{ user_find.json.result | json_query('result[].mail') | 
> list | to_nice_yaml }}"
> 
>   - name: Prepare report
>     template:
>       src: /root/emails.txt.j2
>       dest: /root/emails.txt
>     delegate_to: localhost
>     run_once: true
> 
> The j2 template:
> 
> User Emails:
> 
> Date generated: {{ now(false, '%m/%d/%Y %I:%M:%S') }}
> {{ user_list }}
> 
> This returns the following in the text file:
> 
> User Emails:
> 
> Date generated: 11/12/2020 09:40:26
> -   - us...@example.com
> -   - us...@example.com
> 
> How can I strip out the preceding dashes?

Please post a sample of the JSON in user_find.json.result.

Regards
 Racke

> 
> Thanks,
> Harry
> 
> -- 
> 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/c0bc1bea-edbe-4cc7-813e-81d5f484b8f7n%40googlegroups.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/20b409ab-0b91-fd7a-bf3c-e12e5faa87bc%40linuxia.de.


OpenPGP_0x5B93015BFA2720F8.asc
Description: application/pgp-keys


OpenPGP_signature
Description: OpenPGP digital signature