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?
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…
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.
Would force=yes overwrite the symlink that already exists?
I think in this case you want a ‘follow=true’ which if it found a symlink would follow to source and validate that?