This sort of works:
- hosts: master
tasks:
- name loop through slaves and copy template results to master
template: src=template.txt dest={item}.txt
with_items: {{groups.slaves}}
What I really want is this but it fails since item “has no attribute ‘inventor_hostname’”:
- hosts: master
tasks:
- name loop through slaves and copy template results to master
template: src=template.txt dest={item.inventory_hostname}.txt
with_items: {{groups.slaves}}
Assuming that can be made to work, the template.txt also assumes it has access to a host, complete with host variables etc.