Replies: 2 comments 1 reply
-
|
netlab does not evaluate the vars values, but Ansible does. Setting a group variable to a Jinja2 template should result in that template being evaluated in Ansible when you use that variable in an Ansible-rendered Jinja2 template. For example, using the following setting in a lab topology file: results in Now for that problem of yours ;) To get just the IPv4 address, you can use Also, here's the trick if you want to access any other value from another node. Use However, what you get in ipv4 interface attribute is a prefix, so you'll have to use Ansible ipaddr filter to extract just the IP address from it. |
Beta Was this translation helpful? Give feedback.
-
|
I thought I tried this and couldn't get it to work, but maybe I had a typo or something. I just tried it again and it works perfectly. Thank you so much for the response, and for your work on netlab. It's turned into my new favorite thing! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using netlab to validate some configurations that will be generated via netbox config templates. When doing this I have configuration context variables that include things like syslog_server and radius_server. I would like to override those to feature locally defined servers so that they will work in the lab.
I can do something like this with static definitions, and reference them inside of jinja templates:
But what I would like to do is say radius_server: IP address of whatever the primary IP of the "freeradius" node
I tried setting radius_server: "{{ host.freeradius.ipv4.0 }}" but jinja isn't parsed here like in an ansible playbook.
Is there some way to accomplish this? One option I'm thinking of looking at right now is to statically define the radius_server and others to make sure they get the same IP as the official template. I'd rather not go that route though because it limits the flexibility.
Beta Was this translation helpful? Give feedback.
All reactions