It looks like a fix for this has already been made in latest development version of ansible.
https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/powershell.ps1#L214 Are you able to try latest development version? Jon On Monday, 21 March 2016 05:48:53 UTC, ishan jain wrote: > > I am trying to check if some symbolic links exists or not on a windows > 2012 R2 machine using win_file module. It works fine in case of directory > symbolic links but poses an error when the path specified is a file > symbolic link that is actively being used by a process. This link is a link > to jar file and here is what i am using in ansible: > > win_stat: path=E:\folder\link2\some_dir\link3.jar > > I get the following error because the file is actively in use: > > "msg": { > "changed": false, > "exception": "At > C:\\Users\\Ishan\\AppData\\Local\\Temp\\ansible-tmp-1458122016.24-112690440585191\\win_stat.ps1:231 > > char:9\r\n+ $fp = [System.IO.File]::Open($path, > [System.IO.Filemode]::Open, [System. ...\r\n+ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", > "failed": true, > "msg": "Exception calling \"Open\" with \"3\" argument(s): \"The > process cannot access the file 'E:\\folder\\link2\\some_dir\\link3.jar' > because it is being used by another process.\"" > } > > The script i am writing will need to check if a sym link exists and most > of the time it will check that on an active jar file link. How can i make > it not pose an error ? > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/71010b09-b9a7-407e-b296-af41a642653e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
