diff --git a/plugins/modules/ipauser.py b/plugins/modules/ipauser.py index dcea92f467..74fc11de76 100644 --- a/plugins/modules/ipauser.py +++ b/plugins/modules/ipauser.py @@ -1449,6 +1449,10 @@ def main(): del args["userpassword"] if "random" in args: del args["random"] + # if using "random:false" password should not be + # generated. + if not args.get("random", True): + del args["random"] if "noprivate" in args: del args["noprivate"] diff --git a/tests/user/test_user.yml b/tests/user/test_user.yml index 8af9a80a46..8c2f8a125e 100644 --- a/tests/user/test_user.yml +++ b/tests/user/test_user.yml @@ -87,6 +87,17 @@ register: result failed_when: not result.changed or result.failed + - name: Add existing user with 'random:false' + ipauser: + ipaadmin_password: SomeADMINpassword + ipaapi_context: "{{ ipa_context | default(omit) }}" + name: pinky + first: pinky + last: Acme + random: false + register: result + failed_when: result.changed or result.failed + - name: Set street, again ipauser: ipaadmin_password: SomeADMINpassword