Hello Kai Stian,

thank you to have a look into this!

Am Donnerstag, 18. Januar 2018 15:17:02 UTC+1 schrieb Kai Stian Olstad:
>
> - debug: 
>     msg: '{% for k, v in getent_group.iteritems() %}{% if v.1 == "1000" 
> %}{{ k }}{% endif %}{% endfor %}' 
>

Whow! This works!
    - debug:
        msg: "Primary group: {{ group_name | default( 'not found', true ) 
}}"
      vars:
        group_name: >-
          {% for k, v in getent_group.iteritems() %}{% if v.1 == 
group_id.__str__() %}{{ k }}{% endif %}{% endfor %}

While I had loved to learn some dark sides of json_query, this solves my 
current issue - thank you very much, both!

Have a nice weekend
best regards
Henning


PS: __str__() may seem redundant, but in one of my testcases, the 
comparison failed due to group_id being defined numerically.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9f7b3c62-b126-45bb-8e1e-0aee4a78b61b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to