On Thursday, November 5, 2020 at 5:16:20 PM UTC-5, [email protected] wrote:
>
> So i'm having difficulties and am quite stuck...
>
> My goal is to capture details from a UNC paths NTFS ACLS.
>
> - 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'
>
json_query() is almost never needed, and adds a whole other language to
learn (JMESPath) on top of the Jinja that you need to learn in order to use
Ansible.
You can replace both of your set_fact calls with:
- name: plate fish
set_fact:
caughtfish: "{{ fishing.stdout | from_json |
map(attribute='SamAccountName') | list }}"
See https://jinja.palletsprojects.com/en/2.11.x/templates/#map for more
information on map().
--
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/de4bedc7-83fa-4b1a-a168-c6d417d82a35o%40googlegroups.com.