Last active
October 18, 2017 14:19
-
-
Save Kahn/8856851 to your computer and use it in GitHub Desktop.
Working jinja template using Ansible hostvars
This file contains 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
{% for host in groups['switches'] %} | |
define host { | |
use generic-switch | |
host_name {{ host }} | |
alias {{ hostvars[host]['label'] }} | |
address {{ host }} | |
hostgroups SWITCHES | |
contact_groups networkadmins | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
13:07 < bcoca> swilson_au: host is just a string, host.label doesnt exist
13:08 < bcoca> hostvars[host]['label'] might be what you want