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

Attachment: OpenPGP_0x5B93015BFA2720F8.asc
Description: application/pgp-keys

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to