diff --git a/changelogs/fragments/83600-fileglob-lookup_Pattern-matching-on-directory-file.yml b/changelogs/fragments/83600-fileglob-lookup_Pattern-matching-on-directory-file.yml new file mode 100644 index 00000000000..d5b5eda96ae --- /dev/null +++ b/changelogs/fragments/83600-fileglob-lookup_Pattern-matching-on-directory-file.yml @@ -0,0 +1,2 @@ +minor_changes: + - fileglob lookup - Pattern matching on directory & file (https://github.com/ansible/ansible/pull/83600) diff --git a/lib/ansible/plugins/lookup/fileglob.py b/lib/ansible/plugins/lookup/fileglob.py index fa8e96359fc..02e3614fb1d 100644 --- a/lib/ansible/plugins/lookup/fileglob.py +++ b/lib/ansible/plugins/lookup/fileglob.py @@ -91,7 +91,7 @@ class LookupModule(LookupBase): for term in terms: for path in found_paths: term_results = [ - to_text(g.as_posix(), errors="surrogate_or_strict") + to_text(str(g), errors="surrogate_or_strict") for g in path.glob(term) if g.is_file() ]