> 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 [email protected] 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) <[email protected]>
> 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 <[email protected] <mailto:
>> [email protected]>> wrote:
>> >
>> > This is a simple list, which is what you wanted.
>> >
>> > On Fri, 13 Nov 2020 at 17:28, [email protected] <mailto:
>> [email protected]> <[email protected]
>> > <mailto:[email protected]>> wrote:
>> > >
>> > > So now I'm getting this:
>> > >
>> > > User Emails:
>> > >
>> > > Date generated: 11/13/2020 11:23:32
>> > > [u'[email protected] <mailto:u%[email protected]>',
>> u'[email protected] <mailto:u%[email protected]>']
>> > >
>> > > Harry
>> > >
>> > > On Friday, November 13, 2020 at 11:13:27 AM UTC-5
>> [email protected] <mailto:[email protected]> wrote:
>> > >>
>> > >> On Fri, 13 Nov 2020 at 16:48, [email protected] <mailto:
>> [email protected]> <[email protected]
>> > <mailto:[email protected]>> 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
>> > [email protected] <mailto:
>> ansible-project%[email protected]>.
>> > > 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
>> > [email protected] <mailto:
>> ansible-project%[email protected]>.
>> > 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
>> > [email protected] <mailto:
>> [email protected]>.
>> > 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 [email protected].
>> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/78ed1524-415b-46c8-bdfa-ebcbf6d06247n%40googlegroups.com.