Hi, I have a group named “zookeeper_node”:
tasks:
- debug: msg=“System {{ groups.zookeeper_node }}”
OUTPUT:
ok: [mesosnode01] => {
“msg”: “System [‘mesosnode01’, ‘mesosnode02’, ‘mesosnode03’]”
}
I want to transform it into array of dicts:
[{‘host’: ‘mesosnode01’},{‘host’: ‘mesosnode02’}, {‘host’: ‘mesosnode03’}]
and pass as variable to role:
roles:
- { role: ‘ansible-zookeeper’,
zookeeper_hosts: “{{ groups.zookeeper_node | some magic expression here … }}”
}
Can I do it in Ansible?