{% if variable == 'one' %}stuff for one
{% elif variable == 'two' %}stuff for two
{% else %}stuff for anything else
{% endif %}
Note: Returns a list, even if there's only one item.
sname: "{{ inventory_hostname|regex_search('^(.*?-.*?)-','\\1') }}"