diff --git a/changelogs/fragments/dnf-fix-locale-language.yml b/changelogs/fragments/dnf-fix-locale-language.yml new file mode 100644 index 00000000000..e30e435f0fe --- /dev/null +++ b/changelogs/fragments/dnf-fix-locale-language.yml @@ -0,0 +1,2 @@ +bugfixes: + - "dnf - fix output parsing on systems with ``LANGUAGE`` set to a language other than English (https://github.com/ansible/ansible/issues/78193)" diff --git a/lib/ansible/modules/dnf.py b/lib/ansible/modules/dnf.py index 2f9493709d3..06004301b8f 100644 --- a/lib/ansible/modules/dnf.py +++ b/lib/ansible/modules/dnf.py @@ -554,7 +554,8 @@ class DnfModule(YumDnf): def _ensure_dnf(self): locale = get_best_parsable_locale(self.module) - os.environ['LC_ALL'] = os.environ['LC_MESSAGES'] = os.environ['LANG'] = locale + os.environ['LC_ALL'] = os.environ['LC_MESSAGES'] = locale + os.environ['LANGUAGE'] = os.environ['LANG'] = locale global dnf try: