# sym link (file module)

**URL:** <https://forum.ansible.com/t/sym-link-file-module/12229>\
**Category:** Ansible Project\
**Created:** [January 22, 2013, 12:23am UTC](https://forum.ansible.com/t/sym-link-file-module/12229 "2013-01-22T00:23:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yves\_Dorfsman](https://avatars.discourse-cdn.com/v4/letter/y/9de0a6/32.png) [@Yves\_Dorfsman](https://forum.ansible.com/u/Yves_Dorfsman)\
**Post date:** [January 22, 2013, 12:23am UTC](https://forum.ansible.com/t/sym-link-file-module/12229/1 "2013-01-22T00:23:41Z")

</div>

Often we install software in a directory with their version number, then add a link with just the name. e.g.:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cd /opt  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ls -l  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpd-2.0.64  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpd-2.2.23  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpd-2.4.3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpd -\> httpd-2.4.3

Unfortunately the file module only takes full paths, so I'd end up with something like:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpd -\> /opt/httpd-2.4.3

Could we solve that by adding a chdir option to the file module?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 22, 2013, 12:38pm UTC](https://forum.ansible.com/t/sym-link-file-module/12229/2 "2013-01-22T12:38:43Z")

</div>

Wouldn't it be better to just make the destination not require an  
absolute path in that case?

---

<div class="post-metadata">

**Author:** ![Yves\_Dorfsman](https://avatars.discourse-cdn.com/v4/letter/y/9de0a6/32.png) [@Yves\_Dorfsman](https://forum.ansible.com/u/Yves_Dorfsman)\
**Post date:** [January 22, 2013, 4:27pm UTC](https://forum.ansible.com/t/sym-link-file-module/12229/3 "2013-01-22T16:27:26Z")

</div>

No. It is nice to have an entire system self-contain inside a directory, so that you can move the top directory and everything still works, so being able to create relative links instead of full is needed.

Another option for file would be to remove an old one if existing. In some case, we want that, we want that the creation of the new link removes the old one, but sometimes we want the creation to fail if there is already an existing link.
