Skip to content

Commit 0941c94

Browse files
committed
Merge pull request ansible#342 from Jmainguy/user_el5
fixes user module for rhel5 by using -n instead of -N
2 parents 2c1538f + 8b80085 commit 0941c94

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

system/user.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,15 @@ def create_user_useradd(self, command_name='useradd'):
299299
# exists with the same name as the user to prevent
300300
# errors from useradd trying to create a group when
301301
# USERGROUPS_ENAB is set in /etc/login.defs.
302-
cmd.append('-N')
302+
if os.path.exists('/etc/redhat-release'):
303+
dist = platform.dist()
304+
major_release = int(dist[1].split('.')[0])
305+
if major_release <= 5:
306+
cmd.append('-n')
307+
else:
308+
cmd.append('-N')
309+
else:
310+
cmd.append('-N')
303311

304312
if self.groups is not None and len(self.groups):
305313
groups = self.get_groups_set()

0 commit comments

Comments
 (0)