# trouble creating symbolic link

**URL:** <https://forum.ansible.com/t/trouble-creating-symbolic-link/11580>\
**Category:** Ansible Project\
**Created:** [May 28, 2012, 5:10am UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580 "2012-05-28T05:10:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Suraj\_Gupta](https://forum.ansible.com/u/Suraj_Gupta)\
**Post date:** [May 28, 2012, 5:10am UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/1 "2012-05-28T05:10:21Z")

</div>

hi! I’m trying to create a symbol link using the file module example:

```auto
file src=/file/to/link/to dest=/path/to/symlink owner=foo group=foo state=link

```

Unfortunately, ansible-playbook gives me the following error:  
failed: [127.0.0.1] =\> {“failed”: true, “msg”: “”, “parsed”: false}

Is there a way to dig deeper? Does parsed = false mean that the line could not be parsed? I tried the --debug option but there was no extra output. Let me know if I can provide more info.

Thanks!

---

<div class="post-metadata">

**Author:** ![Cosmin\_Luta](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@Cosmin\_Luta](https://forum.ansible.com/u/Cosmin_Luta)\
**Post date:** [May 28, 2012, 6:56am UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/2 "2012-05-28T06:56:51Z")

</div>

This worked for me on version 0.4:

- hosts: all  
tasks:
- name: link the stuff  
action: file src=/etc/passwd dest=/tmp/passwd state=link

What version are you using?

---

<div class="post-metadata">

**Author:** ![Suraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Suraj\_Gupta](https://forum.ansible.com/u/Suraj_Gupta)\
**Post date:** [May 28, 2012, 1:51pm UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/3 "2012-05-28T13:51:04Z")

</div>

I’m using the latest on the devel branch. I switched to master and now I’m getting verbose output. The error I see is the following:

File “//home/suraj/.ansible/tmp/ansible.If0wX3/file”, line 337, in   
os.symlink(src, dest)  
OSError: [Errno 2] No such file or directory

My src and dest are paths do not point to the path above, which seems like a temp path where files are copied (as part of the ansible-playbook process?). I’m configuring the local machine. I’m assuming src and dest point to location on the target machine?

---

<div class="post-metadata">

**Author:** ![Suraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Suraj\_Gupta](https://forum.ansible.com/u/Suraj_Gupta)\
**Post date:** [May 31, 2012, 5:55pm UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/4 "2012-05-31T17:55:09Z")

</div>

anyone? I’m still stuck.

---

<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:** [May 31, 2012, 6:03pm UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/5 "2012-05-31T18:03:44Z")

</div>

you may wish to debug this with the hacking/test-module script in the checkout.

---

<div class="post-metadata">

**Author:** ![Suraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Suraj\_Gupta](https://forum.ansible.com/u/Suraj_Gupta)\
**Post date:** [May 31, 2012, 6:34pm UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/6 "2012-05-31T18:34:28Z")

</div>

good suggestion - I went ahead and used test-module and everything worked fine. The link was created as expected and src/dest pointed to the right files. So somehow the task is failing when its run with ansible-playbook. I reduced my playbook so that the only task is the task in question (just to eliminate any issues related to system state with prior tasks). I still get the error below.

I think the next logical question is what’s up with the .ansible/tmp/ file path in the error message?

---

<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:** [May 31, 2012, 6:36pm UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/7 "2012-05-31T18:36:31Z")

</div>

ok, thanks…that seems indicate there is something up in the handoff to the file module in runner/ **init**.py

If you can paste the most minimal playbook that can repro this with the exact command line used in a github ticket I can take a look.

---

<div class="post-metadata">

**Author:** ![Suraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Suraj\_Gupta](https://forum.ansible.com/u/Suraj_Gupta)\
**Post date:** [May 31, 2012, 7:31pm UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/8 "2012-05-31T19:31:57Z")

</div>

done!

---

<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:** [June 1, 2012, 2:28am UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/9 "2012-06-01T02:28:21Z")

</div>

So the thing I found here was that the code to print error messages in  
the file module was not quoting strings with spaces in them, leading  
to parse errors.

This was done such that the file module could be used without  
requiring Python, which allows very basic ansible things  
(copy/template) to be run without having python-simplejson installed,  
such that you can boostrap ansible to install python-simplejson even  
if it means installing a yum config file. (Yeah, corner case, I  
know...but useful).

Anyway, I have fixed this such that if you try to run this again, you  
should now get proper output.

The test-module script in the "hacking" directory is VERY useful for  
testing modules outside of playbooks and the rest of the framework, if  
folks are interested in ansible I recommend trying it.

---

<div class="post-metadata">

**Author:** ![Suraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Suraj\_Gupta](https://forum.ansible.com/u/Suraj_Gupta)\
**Post date:** [June 3, 2012, 2:52pm UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/10 "2012-06-03T14:52:37Z")

</div>

Hi Michael,

Unfortunately this still doesn’t work. I’m cloning the devel branch. With test-module it works fine, but when I try to create the link via ansible-playbook, I get a failure message. With --debug there is no verbose output as there is with the master branch version. Maybe the first step here is to get --debug to generate more info? Is that something you can fix on devel?

-Suraj

---

<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:** [June 4, 2012, 2:54am UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/11 "2012-06-04T02:54:42Z")

</div>

– Michael

> Hi Michael,
> 
> Unfortunately this still doesn’t work. I’m cloning the devel branch. With test-module it works fine, but when I try to create the link via ansible-playbook, I get a failure message. With --debug there is no verbose output as there is with the master branch version. Maybe the first step here is to get --debug to generate more info? Is that something you can fix on devel?

–debug is going away. --verbose will show returns even on success.

What error are you getting now?

---

<div class="post-metadata">

**Author:** ![Suraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Suraj\_Gupta](https://forum.ansible.com/u/Suraj_Gupta)\
**Post date:** [June 4, 2012, 6:22pm UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/12 "2012-06-04T18:22:41Z")

</div>

Without debug/verbose the error is:  
failed: [127.0.0.1] =\> {“failed”: true, “msg”, “”, “parsed”: false}

with --verbose:  
error: no such option: --verbose  
=)

---

<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:** [June 4, 2012, 10:33pm UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/13 "2012-06-04T22:33:27Z")

</div>

Latest devel or not?

– Michael

---

<div class="post-metadata">

**Author:** ![Suraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Suraj\_Gupta](https://forum.ansible.com/u/Suraj_Gupta)\
**Post date:** [June 5, 2012, 2:04am UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/14 "2012-06-05T02:04:33Z")

</div>

latest devel

---

<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:** [June 5, 2012, 2:09am UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/15 "2012-06-05T02:09:20Z")

</div>

Ok, failed to parse should always show the trace, no flags required. Make sure there is a open ticket.

– Michael

---

<div class="post-metadata">

**Author:** ![Suraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Suraj\_Gupta](https://forum.ansible.com/u/Suraj_Gupta)\
**Post date:** [June 5, 2012, 2:13am UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/16 "2012-06-05T02:13:18Z")

</div>

created issue 449

---

<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:** [June 5, 2012, 2:56am UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/17 "2012-06-05T02:56:31Z")

</div>

Thanks, should be fixed by early next week. Meanwhile I recommend using hacking/test-module to find your symlink error, so we can resolve that also. This way you can find the actual TB we are currently not presenting.

– Michael

---

<div class="post-metadata">

**Author:** ![Suraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Suraj\_Gupta](https://forum.ansible.com/u/Suraj_Gupta)\
**Post date:** [June 5, 2012, 5:20pm UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/18 "2012-06-05T17:20:05Z")

</div>

Hi Michael - There is no error when using test-module. The link is created properly. That’s what’s strange.

---

<div class="post-metadata">

**Author:** ![Suraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Suraj\_Gupta](https://forum.ansible.com/u/Suraj_Gupta)\
**Post date:** [June 5, 2012, 5:40pm UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/19 "2012-06-05T17:40:58Z")

</div>

so I think we should reopen issue 439. I tried but I don’t have permission

---

<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:** [June 5, 2012, 9:05pm UTC](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580/20 "2012-06-05T21:05:52Z")

</div>

There was no error for me so I am afraid you will need to patch it yourself…

– Michael

[Next page](https://forum.ansible.com/t/trouble-creating-symbolic-link/11580.md?page=2)
