splitting the output of {{ ansible_play_name }}

I have a tasks that writes information gathered from remotes to a csv file on localhost

Try this

  {{ ansible_play_name|split('_')|first }}

thanks. I guess that is pretty much the same thing as ...

    {{ ansible_play_name.split('_')[0] }}

... (which I figured out in the meantime).