Export Template

Name
Ansible inventory (YAML)
Description
—
MIME type
text/yaml
File name
—
File extension
yml
Attachment

Data File

Data Source —
Data File —
Data Synced —

Assigned Models

DCIM | device

Environment Parameters

{}

Template

all:
  children:
{% for role in queryset|groupby("role.slug") %}    {{ role.grouper|replace("-", "_") }}:
      hosts:
{% for d in role.list %}        {{ d.name }}:
          ansible_host: {{ d.primary_ip4.address.ip if d.primary_ip4 else d.name }}
          platform: {{ d.platform.slug if d.platform else "unknown" }}
{% endfor %}{% endfor %}