Thanks to halberom on IRC!
This works:
{% for host in groups.lab if 'string' not in host %}
I am using something similar to deploy sssd.conf on our compute nodes:
[domain/LDAP]
autofs_provider = ldap
{%if 'dude' in inventory_hostname %}
ldap_autofs_search_base = ou=autofs.maps,cn=dudecluster,ou=blah,dc=domain
{%endif%}
{%if 'bro' in inventory_hostname %}
ldap_autofs_search_base = ou=autofs.maps,cn=brocluster,ou=blah,dc=domain
{%endif%}
Though I didn't know you could add an if within for loop without doing:
{% if %}
{% for %}