symlinks vs directories

2,724 views
Skip to first unread message

David Reagan

unread,
Dec 30, 2013, 6:47:08 PM12/30/13
to ansible...@googlegroups.com
I have a task that creates a directory. On one server, that directory already exists, but is a symlink. So ansible says the task failed when it runs. The message: "msg: refusing to convert between link and directory for None". Is there a way to tell ansible that a symlink is ok for that task?

Or check if a directory or symlink exists before running the task?

David Reagan

unread,
Dec 30, 2013, 7:48:45 PM12/30/13
to ansible...@googlegroups.com
With some help from IRC, I ended up checking for the paths with the stat module. Sadly, the only way that worked was to make 2 tasks per path. Glad I only had a few to check...

Michael DeHaan

unread,
Dec 31, 2013, 7:22:41 AM12/31/13
to ansible...@googlegroups.com
force=yes is available for such things. 

There have been some recent refinements depending on what version you are using, but you didn't specify.

If force=yes doesn't handle this for you in the latest 1.5 development branch please file a ticket, and also reference the message about "None" as that's suboptimal.

Thanks.


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Michael DeHaan <mic...@ansibleworks.com>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/

David Reagan

unread,
Dec 31, 2013, 10:07:15 AM12/31/13
to ansible...@googlegroups.com
Would force=yes overwrite the symlink that already exists?

--David Reagan


--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/Q5KdwEjugI8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

Brian Coca

unread,
Dec 31, 2013, 10:14:46 AM12/31/13
to ansible...@googlegroups.com
I think in this case you want a 'follow=true' which if it found a symlink would follow to source and validate that?
Reply all
Reply to author
Forward
0 new messages