# Issue creating symbolic link

**URL:** <https://forum.ansible.com/t/issue-creating-symbolic-link/38648>\
**Category:** Ansible Project\
**Created:** [January 11, 2024, 7:25pm UTC](https://forum.ansible.com/t/issue-creating-symbolic-link/38648 "2024-01-11T19:25:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![harry\_devine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/harry_devine/32/5293_2.png) [@harry\_devine](https://forum.ansible.com/u/harry_devine)\
**Post date:** [January 11, 2024, 7:25pm UTC](https://forum.ansible.com/t/issue-creating-symbolic-link/38648/1 "2024-01-11T19:25:44Z")

</div>

I know this should be trivial, but I just cannot get it to work. I’m trying to create a symbolic link in my playbook. I’m trying to link /etc/guacamole/guacamole.properties in the /usr/share/tomcat/.guacamole directory as follows:

- name: Config | Creating Tomcat symlink For guacamole.properties  
ansible.builtin.file:  
src: /etc/guacamole/guacamole.properties  
dest: “{{ ‘/usr/share/’ + guacamole\_tomcat + ‘/.guacamole’ }}”  
state: link  
owner: “{{ guacamole\_tomcat\_user }}”  
group: “{{ guacamole\_tomcat\_user }}”  
mode: 0664  
notify:
- “Restart {{ guacamole\_tomcat\_service }}”
- Kill guacd
- Restart guacd

But my playbook keeps giving me this error:

refusing to convert from directory to symlink for /usr/share/tomcat/.guacamole

Any ideas on what I’m doing wrong?

Thanks,  
Harry

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [January 11, 2024, 7:35pm UTC](https://forum.ansible.com/t/issue-creating-symbolic-link/38648/2 "2024-01-11T19:35:20Z")

</div>

The error can’t be any clearer.  
The symlink you’re trying to create already exists as a directory

---

<div class="post-metadata">

**Author:** ![harry\_devine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/harry_devine/32/5293_2.png) [@harry\_devine](https://forum.ansible.com/u/harry_devine)\
**Post date:** [January 11, 2024, 7:41pm UTC](https://forum.ansible.com/t/issue-creating-symbolic-link/38648/3 "2024-01-11T19:41:59Z")

</div>

I’m trying to create it IN /usr/share/tomcat/.guacamole to point to /etc/guacamole/guacamole.properties. Obviously the play isn’t right, but what should it be? Do I need to make the destination “/usr/share/tomcat/.guacamole/guacamole.properties”? Or are the src and dest options reversed? The /etc/guacamole/guacamole.properties is a file and not a directory.

Thanks,  
Harry

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 11, 2024, 7:50pm UTC](https://forum.ansible.com/t/issue-creating-symbolic-link/38648/4 "2024-01-11T19:50:22Z")

</div>

dest: “{{ ‘/usr/share/’ + guacamole\_tomcat + ‘/.guacamole/guacamole.properties’ }}”

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 11, 2024, 7:53pm UTC](https://forum.ansible.com/t/issue-creating-symbolic-link/38648/5 "2024-01-11T19:53:51Z")

</div>

You can think of them as reversed if it will help you understand it.

As for the ansible.builtin.file module, the “path” (alias “dest”) is the thing you are creating / modifying / deleting. “src” is what the ASCII arrow points to when you do “ls -l” on the command line.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 11, 2024, 8:15pm UTC](https://forum.ansible.com/t/issue-creating-symbolic-link/38648/6 "2024-01-11T20:15:47Z")

</div>

If you think of “src” as “one end of the ‘ls -l’ arrow”, then they are certainly reversed.  
But if you think of “src” as “the source of data when reading from the link”, then “src” makes sense. The “dest” becomes “the place to create the link itself.”

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [January 11, 2024, 8:16pm UTC](https://forum.ansible.com/t/issue-creating-symbolic-link/38648/7 "2024-01-11T20:16:48Z")

</div>

With the strings defined outside the jinja block, it’s a bit clearer:

dest: “/usr/share/{{ guacamole\_tomcat }}/.guacamole/guacamole.properties”

---

<div class="post-metadata">

**Author:** ![harry\_devine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/harry_devine/32/5293_2.png) [@harry\_devine](https://forum.ansible.com/u/harry_devine)\
**Post date:** [January 11, 2024, 8:31pm UTC](https://forum.ansible.com/t/issue-creating-symbolic-link/38648/8 "2024-01-11T20:31:10Z")

</div>

Got it! That cleared up my confusion and it’s working now. I.appreciate you guys setting me straight!

Thanks,  
Harry
