summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Mainguy <jon@soh.re>2014-11-17 10:31:54 -0500
committerJonathan Mainguy <jon@soh.re>2014-11-17 13:26:08 -0500
commit8b8008569fd6a9c2ec4603dedbe27cbd000bdb36 (patch)
treecec72ccd06e151561cd5109bd07d25816f1a5519
parent2c1538f220dcf13750f77b9c151fc29d24d91894 (diff)
downloadansible-modules-core-8b8008569fd6a9c2ec4603dedbe27cbd000bdb36.tar.gz
fixes user module for rhel5 by using -n instead of -N, all other distros will still use -N
-rw-r--r--system/user.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/system/user.py b/system/user.py
index 551384a7..6fe20122 100644
--- a/system/user.py
+++ b/system/user.py
@@ -299,7 +299,15 @@ class User(object):
# exists with the same name as the user to prevent
# errors from useradd trying to create a group when
# USERGROUPS_ENAB is set in /etc/login.defs.
- cmd.append('-N')
+ if os.path.exists('/etc/redhat-release'):
+ dist = platform.dist()
+ major_release = int(dist[1].split('.')[0])
+ if major_release <= 5:
+ cmd.append('-n')
+ else:
+ cmd.append('-N')
+ else:
+ cmd.append('-N')
if self.groups is not None and len(self.groups):
groups = self.get_groups_set()