matching on facts in templates

I have some legacy servers, and I have some servers that aren’t legacy and being built a new way with new network interfaces.

The playbook/template worked matching on the old template and facts, but now that a new interface exists, I need to see if it it exists, and if it does, use it.

I’ve got this https://gist.github.com/esacteksab/b1b2439fa6acb68dfc1e

And errors but -vvvv isn’t clear what host(s) it’s failing on.

Is this supported in the template? Is the matching correct as far as hostvars[host][‘ansible_br305’] or is there some other way to get at facts in a template?

Thanks!

I needed

{% if ‘ansible_br305’ in hostvars[hosts] %} and it works!

Thanks.