Ansible – Unable to look up a name or access an attribute in template string

I was getting this odd error

AnsibleUndefinedVariable: Unable to look up a name or access an attribute in template string ({% if ansible_fqdn in groups['compute_nodes'] %}

 

Turns out compute_nodes wasn’t in my host inventory file.. oops! Easy fix, not so easy to diagnose