Thanks for the hint,

Flatting the list results with 

TASK [print] 
********************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": {
        "all": [
            "host1",
            "host2",
            "host3"
        ],
        "group0": [
            "host1"
        ],
        "group1": [
            "host2"
        ],
        "group2": [
            "host3"
        ],
        "ungrouped": []
    }
}

What i'm trying to achieve is -

TASK [print] 
********************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": {
        "all": [
            "host1",
            "host2",
            "host3"
        ],
        "group0": [
            "host1",
            "host2"
        ],
        "group1": [
            "host3"
        ],
        "ungrouped": []
    }
}


On Monday, September 9, 2019 at 10:25:53 AM UTC+3, Vladimir Botka wrote:
>
> On Mon, 9 Sep 2019 00:05:26 -0700 (PDT) 
> Danny Rehelis <aut...@gmail.com <javascript:>> wrote: 
>
> >  vars: 
> >    my_hosts: 
> >      - ['host1', 'host2'] 
> >      - ['host3'] 
> > [...] 
> > loop: "{{ my_hosts }}" 
> > [...] 
> > ERROR! Unexpected Exception, this is probably a bug: unhashable type: 
> 'list' 
> > 
> > I'm having hard time iterating this var in order to add_host properly 
> into 
> > X groups. I want this to be dynamic as much as possible. 
>
> Flatten the lists. 
>
>       loop: "{{ my_hosts|flatten }}" 
>
> 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/266cb5d1-6665-49c4-be1d-9f94429bcf00%40googlegroups.com.

Reply via email to