summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelogs/fragments/ansible-basic-tmpdir-uniqueness.yml2
-rw-r--r--lib/ansible/module_utils/csharp/Ansible.Basic.cs3
2 files changed, 4 insertions, 1 deletions
diff --git a/changelogs/fragments/ansible-basic-tmpdir-uniqueness.yml b/changelogs/fragments/ansible-basic-tmpdir-uniqueness.yml
new file mode 100644
index 0000000000..0240949563
--- /dev/null
+++ b/changelogs/fragments/ansible-basic-tmpdir-uniqueness.yml
@@ -0,0 +1,2 @@
+bugfixes:
+- Windows - Ensure the module temp directory contains more unique values to avoid conflicts with concurrent runs - https://github.com/ansible/ansible/issues/80294
diff --git a/lib/ansible/module_utils/csharp/Ansible.Basic.cs b/lib/ansible/module_utils/csharp/Ansible.Basic.cs
index c68281ef1b..16480992e8 100644
--- a/lib/ansible/module_utils/csharp/Ansible.Basic.cs
+++ b/lib/ansible/module_utils/csharp/Ansible.Basic.cs
@@ -176,7 +176,8 @@ namespace Ansible.Basic
}
string dateTime = DateTime.Now.ToFileTime().ToString();
- string dirName = String.Format("ansible-moduletmp-{0}-{1}", dateTime, new Random().Next(0, int.MaxValue));
+ string dirName = String.Format("ansible-moduletmp-{0}-{1}-{2}", dateTime, System.Diagnostics.Process.GetCurrentProcess().Id,
+ new Random().Next(0, int.MaxValue));
string newTmpdir = Path.Combine(baseDir, dirName);
#if CORECLR
DirectoryInfo tmpdirInfo = Directory.CreateDirectory(newTmpdir);