{% macro nodes() %} {%- for _host in groups['all'] %} service_type: host addr: {{hostvars[_host]['addr']}} hostname: {{ _host }} location: {% for key, value in hostvars[_host]['location'].items() %} {{key}}: {{value}} {% endfor %} labels: {% for i in hostvars[_host]['labels']%} - {{ i }} {% endfor %} --- {% endfor %} {% endmacro %} {{ nodes() }} service_type: mon placement: label: "mon" --- service_type: mgr service_name: mgr placement: label: "mgr" --- service_type: osd service_id: 12_SDD service_name: osd.all-available-devices placement: label: "osd" spec: data_devices: all: true