mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
fixes user module for rhel5 by using -n instead of -N, all other distros will still use -N
This commit is contained in:
parent
2363074dd8
commit
a71ce0615a
1 changed files with 9 additions and 1 deletions
|
@ -299,6 +299,14 @@ class User(object):
|
||||||
# exists with the same name as the user to prevent
|
# exists with the same name as the user to prevent
|
||||||
# errors from useradd trying to create a group when
|
# errors from useradd trying to create a group when
|
||||||
# USERGROUPS_ENAB is set in /etc/login.defs.
|
# USERGROUPS_ENAB is set in /etc/login.defs.
|
||||||
|
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')
|
cmd.append('-N')
|
||||||
|
|
||||||
if self.groups is not None and len(self.groups):
|
if self.groups is not None and len(self.groups):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue