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": "[email protected]",
            "result": {
                "count": 1822,
                "result": [
                    {
                        "dn": 
"uid=user1,cn=users,cn=accounts,dc=example,dc=com",
                        "gidnumber": [
                            "10000"
                        ],
                        "givenname": [
                            "User1"
                        ],
                        "homedirectory": [
                            "/home/user1"
                        ],
                        "krbcanonicalname": [
                            "[email protected]"
                        ],
                        "krbprincipalname": [
                            "[email protected]"
                        ],
                        "loginshell": [
                            "/bin/bash"
                        ],
                        "mail": [
                            "[email protected]"
                        ],
                        "nsaccountlock": false,
                        "sn": [
                            "User"
                        ],
                        "telephonenumber": [
                            "(555) 555-5555"
                        ],
                        "uid": [
                            "user1"
                        ],
                        "uidnumber": [
                            "1111"
                        ]
                    },
                    {
                        "dn": 
"uid=user2,cn=users,cn=accounts,dc=example,dc=com",
                        "gidnumber": [
                            "10000"
                        ],
                        "givenname": [
                            "User2"
                        ],
                        "homedirectory": [
                            "/home/user2"
                        ],
                        "krbcanonicalname": [
                            "[email protected]"
                        ],
                        "krbprincipalname": [
                            "[email protected]"
                        ],
                        "loginshell": [
                            "/bin/bash"
                        ],
                        "mail": [
                            "[email protected]"
                        ],
                        "nsaccountlock": false,
                        "sn": [
                            "User"
                        ],
                        "telephonenumber": [
                            "(555)555-5556"
                        ],
                        "uid": [
                            "user2"
                        ],
                        "uidnumber": [
                            "2222"
                        ]
                    },
                    }
                ],
                "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 [email protected] wrote:

> At least something that is valid json with at least two iterations
> should be welcome.
>
> On Fri, 13 Nov 2020 at 14:53, [email protected] <[email protected]> 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 [email protected] 
> 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, [email protected] <[email protected]> 
> 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": [
> >> > "99999"
> >> > ],
> >> > "givenname": [
> >> > "Harry"
> >> > ],
> >> > "homedirectory": [
> >> > "/home/harry.devine"
> >> > ],
> >> > "krbcanonicalname": [
> >> > "[email protected]"
> >> > ],
> >> > "krbprincipalname": [
> >> > "[email protected]"
> >> > ],
> >> > "loginshell": [
> >> > "/bin/bash"
> >> > ],
> >> > "mail": [
> >> > "[email protected]"
> >> > ],
> >> > "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 [email protected] 
> wrote:
> >> >>
> >> >> On 11/12/20 3:49 PM, [email protected] 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
> >> >> > - - [email protected]
> >> >> > - - [email protected]
> >> >> >
> >> >> > 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
> >> >> > [email protected] <mailto:
> [email protected]>.
> >> >> > 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 [email protected].
> >> > 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 [email protected].
> > 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9cda5a0e-3319-4d28-9018-c2100f4b2f92n%40googlegroups.com.

Reply via email to