Hey,
Given the following playbook -
- hosts: localhost
gather_facts: false
vars:
my_hosts:
- ['host1', 'host2']
- ['host3']
- name: Add host
add_host:
name: '{{ item }}'
groups: "group{{ index }}"
loop: "{{ my_hosts }}"
loop_control:
index_var: index
---
PLAY [localhost]
****************************************************************************************************************************************************************************************************************************
TASK [debug]
********************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
"msg": [
[
"host1",
"host2"
],
[
"host3"
]
]
}
TASK [Add host]
*****************************************************************************************************************************************************************************************************************************
changed: [localhost] => (item=['host1', 'host2'])
changed: [localhost] => (item=['host3'])
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.
--
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/a1863c97-5fa6-4541-baaf-d4c3cfb88f53%40googlegroups.com.