On Tue, 27 Aug 2019 13:32:11 -0700 (PDT)
Nicholas Britton <britton.nicho...@gmail.com> wrote:

> I am building a list with output stored from a uri call:
> [...]
>  - name: create list of hostgroups ids
>     set_fact:
>       hostgroupnum_l: "{{hostgroupnum_l}} + 
> ['{{item.hostGroup.hostGroupNumber}}']"
>     with_items: "{{hostgroups.json.data}}"

Try this:

        - name: create list of hostgroups ids
          set_fact:
            hostgroupnum_l: "{{ hostgroupnum_l|default([]) + 
                                [item.hostGroup.hostGroupNumber] }}"
          loop: "{{ hostgroups.json.data }}"

Cheers,

        -vlado

-- 
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/20190829161337.2d79b1c1%40gmail.com.

Attachment: pgpIfIgyuatPf.pgp
Description: OpenPGP digital signature

Reply via email to