It's not getting any clearer to me. Let's take some steps back. Please
confirm if I'm on the right track.


You end up with this data structure:

    "ansible_facts": {
        "chum": [
            {
                "DistinguishedName": "CN=LASTNAME\\, FIRSTNAME
(USN123),OU=Users,OU=ORGANIZATION,DC=CONSONTO,DC=net",
                "SamAccountName": "USN123"
            },
            {
                "DistinguishedName": "CN=LASTNAME1\\, FIRSTNAME1
(USN234),OU=Users,OU=ORGANIZATION,DC=CONSONTO,DC=net",
                "SamAccountName": "USN234"
            }
        ]
    },

Is that the correct data? I.e. does it contain everything you need?
And if so, what do you want to do/extract from this?
You want perhaps to end up with a list of the SamAccountNames, i.e.:

- USN123
- USN234

?
Or something entirely different?

On Fri, 6 Nov 2020 at 15:12, [email protected] <[email protected]> wrote:
>
> Also, the variable names are a bit eclectic I know, but...
> Give a man a fish, feed him for a day, teach him for a fish, feed him for 
> life.
> Playbook name is fishing
> chum the water
> catch fish,
> prep fish
> serve fish,
> silly I know, but it makes sense.
>
> On Friday, November 6, 2020 at 9:08:28 AM UTC-5 [email protected] wrote:
>>
>> No, pretty positive when I'm asking for the value of a variable, I'm 
>> expecting for more output than none.
>>
>>
>> - name: plate SamAccountName's
>>     set_fact:
>>       caughtfish: "{{ chum | json_query(jmesquery) }}"
>>     vars:
>>       jmesquery: 'chum.SamAccountName'
>>
>>   - name: serve samaccountnames
>>     debug:
>>       msg: " Fucking output something already! {{ caughtfish }}"
>>
>>
>> I'm mostly at a loss of what I'm doing wrong with json_query for it to net 
>> me ... no results... each time when simply asking for it to query 
>> SamAccountName.
>> Either I'm grossly misunderstanding how it functions, or my data/query is 
>> boned.
>>
>>
>> On Friday, November 6, 2020 at 1:09:51 AM UTC-5 [email protected] wrote:
>>>
>>> On Thu, 5 Nov 2020 at 23:17, [email protected] <[email protected]> wrote:
>>>>
>>>> So i'm having difficulties and am quite stuck...
>>>>
>>>> My goal is to capture details from a UNC paths NTFS ACLS.
>>>>
>>>> Important details are below.
>>>>
>>>>
>>>>   - name: Teach him to fish - Run it
>>>>     win_shell: |
>>>>       . C:\Temp\grp_enum.ps1
>>>>
>>>>       enumerate -path "{{ path }}"
>>>>     become: yes
>>>>     become_method: runas
>>>>     vars:
>>>>       ansible_become_user: '{{ h_become_user }}'
>>>>       ansible_become_pass: '{{ h_become_pass }}'
>>>>     register: fishing
>>>>
>>>>   - name: process fish
>>>>     set_fact:
>>>>       chum: "{{ fishing.stdout | from_json }}"
>>>>
>>>>   - name: plate SamAccountName's
>>>>     set_fact:
>>>>       caughtfish: "{{ chum | json_query(jmesquery) }}"
>>>>     vars:
>>>>       jmesquery: 'chum.SamAccountName'
>>>>
>>>>   - name: serve samaccountnames
>>>>     debug:
>>>>       msg: " Fucking output something already! {{caughtfish}}"
>>>>
>>>> Spits out JSON formatted
>>>>     "ansible_facts": {
>>>>         "chum": [
>>>>             {
>>>>                 "DistinguishedName": "CN=LASTNAME\\, FIRSTNAME 
>>>> (USN123),OU=Users,OU=ORGANIZATION,DC=CONSONTO,DC=net",
>>>>                 "SamAccountName": "USN123"
>>>>             },
>>>>             {
>>>>                 "DistinguishedName": "CN=LASTNAME1\\, FIRSTNAME1 
>>>> (USN234),OU=Users,OU=ORGANIZATION,DC=CONSONTO,DC=net",
>>>>                 "SamAccountName": "USN234"
>>>>             }
>>>>         ]
>>>>     },
>>>>
>>>>
>>>> Yet no matter how I skin this fish...
>>>>
>>>>
>>>>
>>>> PLATES results
>>>>
>>>> ok: [l1pnchwmgt12.columbuschildrens.net] => {
>>>>     "ansible_facts": {
>>>>         "caughtfish": ""
>>>>     },
>>>>     "changed": false
>>>> }
>>>>
>>>> SERVES results
>>>>
>>>> ok: [l1pnchwmgt12.columbuschildrens.net] => {
>>>>     "msg": " Fucking output something already! "
>>>> }
>>>>
>>>>
>>>> I can't get this thing to give me any data, what so ever...
>>>
>>>
>>>
>>> It does give you data, but judging from your comments, not the data you 
>>> want, or in a different format. But it's not clear what you want ('skin 
>>> fish'??).
>>>
>>> What are you exactly looking for?
>>> What is the expected result?
>>>
>>>
>>>>
>>>>
>>>> P.s. google groups sucks in conversion, no format as code is a sin.
>>>>
>>>> --
>>>> 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/27f9734c-f60a-43e9-93a4-2b022c377710n%40googlegroups.com.
>>>
>>> --
>>> Sent from a mobile device - please excuse the brevity, spelling and 
>>> punctuation.
>
> --
> 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/5035f606-85ff-40dd-bad5-e1ed329180b6n%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/CAL8fbwOZGETLRStXqsrvnMA2GFuRkcF44Q0M%2BJ1q6w%3DmRHWBVQ%40mail.gmail.com.

Reply via email to