I am using the win_file ansible module to remove a directory. However, when it runs the playbook, I am seeing the following error:
"msg": "Failed to delete C:\\product\\eclipse-cpp-2019-06-R-win32-x86_64\\eclipse\\plugins\\com.amazonaws.eclipse.elasticbeanstalk_1.0.0.v201807201743\\com\\amazonaws\\eclipse\\elasticbeanstalk\\server\\ui\\configEditor: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."
The Ansible playbook (uninstall.yml) is being run via UCD (UrbanCode Deploy). This is my ansible code:
- name: Remove install_home folder
win_file:
path: "{{install_home}}"
state: absent
Anyone have any thoughts on whether the above error is caused by an OS, Ansible, UCD or limitation. I'd appreciate any thoughts/guidance on how I may get past the above.
Many thanks
Its the limitation coming from the
OS, as per this:To prevent this issue:
To specify an extended-length path, use the
"\\?\"prefix. For example,"\\?\D:\very long path".The maximum path of32,767characters is approximate, because the "\?" prefix may be expanded to a longer string by the system at run time, and this expansion applies to the total length.Eg: