{ "kind": "Endpoints", "apiVersion": "v1", "metadata": { "name": "glusterfs" }, "subsets": [ {% for host in groups['gfs-cluster'] %} { "addresses": [ { "ip": "{{hostvars[host]['ip']}}" } ], "ports": [ { "port": 1 } ] }{%- if not loop.last %}, {% endif -%} {% endfor %} ] }