Created
June 28, 2017 09:02
-
-
Save rsvalerio/8366c443ada0c42513a652899ed58577 to your computer and use it in GitHub Desktop.
netbox-ansible-inventory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% regroup queryset|dictsort:"device_role.id" by device_role as per_role %} | |
{% for role in per_role %} | |
[{{ role.grouper.slug }}] | |
{% for device in role.list %}{% if device.primary_ip %} | |
{{ device.name|slugify }} ansible_host={{ device.primary_ip.address.ip }}{% endif %}{% endfor %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment