# splitting the output of {{ ansible\_play\_name }}

**URL:** <https://forum.ansible.com/t/splitting-the-output-of-ansible-play-name/38195>\
**Category:** Ansible Project\
**Created:** [July 6, 2023, 7:10am UTC](https://forum.ansible.com/t/splitting-the-output-of-ansible-play-name/38195 "2023-07-06T07:10:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dulhaver](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dulhaver/32/1061_2.png) [@dulhaver](https://forum.ansible.com/u/dulhaver)\
**Post date:** [July 6, 2023, 7:10am UTC](https://forum.ansible.com/t/splitting-the-output-of-ansible-play-name/38195/1 "2023-07-06T07:10:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [July 6, 2023, 7:43am UTC](https://forum.ansible.com/t/splitting-the-output-of-ansible-play-name/38195/2 "2023-07-06T07:43:01Z")

</div>

Try this

&nbsp;&nbsp;{{ ansible\_play\_name|split('\_')|first }}

---

<div class="post-metadata">

**Author:** ![dulhaver](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dulhaver/32/1061_2.png) [@dulhaver](https://forum.ansible.com/u/dulhaver)\
**Post date:** [July 6, 2023, 8:14am UTC](https://forum.ansible.com/t/splitting-the-output-of-ansible-play-name/38195/3 "2023-07-06T08:14:48Z")

</div>

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

&nbsp;&nbsp;&nbsp;&nbsp;{{ ansible\_play\_name.split('\_')[0] }}

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