diff --git a/plugins/module_utils/ansible_freeipa_module.py b/plugins/module_utils/ansible_freeipa_module.py index 16e7343fffbd60979e05bcd660a9689061dfe1e6..5ac52c7388e5d91612fb3cad9aca1c758433ec8f 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 0000000000000000000000000000000000000000..27d03de756655fae5c1d84ffdb5ab7d0271feb1e --- /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