diff --git a/lib/ansible/modules/system/user.py b/lib/ansible/modules/system/user.py index 3444b2239a6..43efd48445e 100644 --- a/lib/ansible/modules/system/user.py +++ b/lib/ansible/modules/system/user.py @@ -923,7 +923,10 @@ class FreeBsdUser(User): if self.expires: days = (time.mktime(self.expires) - time.time()) // 86400 cmd.append('-e') - cmd.append(str(int(days))) + if self.clearexpires < 0: + cmd.append('0') + else: + cmd.append(str(int(days))) # modify the user if cmd will do anything if cmd_len != len(cmd):