From 54619f70f4b79f121c5062d54e9732d3cbb24377 Mon Sep 17 00:00:00 2001 From: stefankaerst Date: Sun, 11 Jun 2017 14:44:22 +0200 Subject: [PATCH] Fixes #20096 --- lib/ansible/modules/system/user.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/system/user.py b/lib/ansible/modules/system/user.py index 3444b2239a6e78..43efd48445e5bd 100644 --- a/lib/ansible/modules/system/user.py +++ b/lib/ansible/modules/system/user.py @@ -923,7 +923,10 @@ def modify_user(self): 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):