From 158b32cd7a55e2d98fc2cfa2cf9d935e9b2a9b5d Mon Sep 17 00:00:00 2001 From: Russell Parks Date: Wed, 13 Dec 2017 15:30:51 -0600 Subject: [PATCH] user: Fix add for SuSE Linux Enterprise 11 (#27015) --- lib/ansible/modules/system/user.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ansible/modules/system/user.py b/lib/ansible/modules/system/user.py index f0b153b052..8d863ba8a5 100644 --- a/lib/ansible/modules/system/user.py +++ b/lib/ansible/modules/system/user.py @@ -367,6 +367,13 @@ class User(object): cmd.append('-n') else: cmd.append('-N') + elif os.path.exists('/etc/SuSE-release'): + # -N did not exist in useradd before SLE 11 and did not + # automatically create a group + dist = platform.dist() + major_release = int(dist[1].split('.')[0]) + if major_release >= 12: + cmd.append('-N') else: cmd.append('-N')