diff --git a/plugins/module_utils/ansible_freeipa_module.py b/plugins/module_utils/ansible_freeipa_module.py index 16e7343f..5ac52c73 100644 --- a/plugins/module_utils/ansible_freeipa_module.py +++ b/plugins/module_utils/ansible_freeipa_module.py @@ -93,6 +93,9 @@ except ImportError: if six.PY3: unicode = str +# ansible-freeipa requires locale to be C, IPA requires utf-8. +os.environ["LANGUAGE"] = "C" + def valid_creds(module, principal): # noqa """Get valid credentials matching the princial, try GSSAPI first.""" diff --git a/tests/environment/test_locale.yml b/tests/environment/test_locale.yml new file mode 100644 index 00000000..27d03de7 --- /dev/null +++ b/tests/environment/test_locale.yml @@ -0,0 +1,32 @@ +--- +- name: Test language variations + hosts: ipaserver + + tasks: + - name: Ensure a host is not present, with language set to "de_DE". + ipahost: + ipaadmin_password: SomeADMINpassword + name: nonexistent + state: absent + environment: + LANGUAGE: "de_DE" + register: result + failed_when: result.failed or result.changed + + - name: Ensure a host is not present, with language set to "C". + ipahost: + ipaadmin_password: SomeADMINpassword + name: nonexistent + state: absent + environment: + LANGUAGE: "C" + register: result + failed_when: result.failed or result.changed + + - name: Ensure a host is not present, using controller language. + ipahost: + ipaadmin_password: SomeADMINpassword + name: nonexistent + state: absent + register: result + failed_when: result.failed or result.changed