# Basename of {file} in ansible\_managed

**URL:** <https://forum.ansible.com/t/basename-of-file-in-ansible-managed/16088>\
**Category:** Ansible Project\
**Created:** [August 31, 2014, 2:05pm UTC](https://forum.ansible.com/t/basename-of-file-in-ansible-managed/16088 "2014-08-31T14:05:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephan.rickauer](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@stephan.rickauer](https://forum.ansible.com/u/stephan.rickauer)\
**Post date:** [August 31, 2014, 2:05pm UTC](https://forum.ansible.com/t/basename-of-file-in-ansible-managed/16088/1 "2014-08-31T14:05:24Z")

</div>

Friends,

{file} in ansible\_managed uses gets replaced with the filename and its full path. Is there another variable to get the filename only, omitting the full path?

Thanks!  
Stephan

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 2, 2014, 10:57pm UTC](https://forum.ansible.com/t/basename-of-file-in-ansible-managed/16088/2 "2014-09-02T22:57:21Z")

</div>

There’s a rather limited set of variables sent to what is provided to the ansible\_managed as it’s not evaluated by the template engine, but some basic string.format operations.

Jinja2 _does_ have a basename filter, though this line is not evaluated by Jinja2, so changing this would require the code to itself change, and also some code to keep compatibility.

As such, this is unlikely to change at this time.
