Merge pull request #40325 from cxmcc/user-nologinit-option

Add 'nologinit' option for useradd module and user.present state.
This commit is contained in:
Nicole Thomas 2017-03-29 17:07:42 -06:00 committed by GitHub
commit d30ccede14
2 changed files with 15 additions and 2 deletions

View File

@ -116,7 +116,8 @@ def add(name,
homephone='', homephone='',
createhome=True, createhome=True,
loginclass=None, loginclass=None,
root=None): root=None,
nologinit=False):
''' '''
Add a user to the minion Add a user to the minion
@ -178,6 +179,9 @@ def add(name,
and __grains__['kernel'] != 'OpenBSD'): and __grains__['kernel'] != 'OpenBSD'):
cmd.append('-M') cmd.append('-M')
if nologinit:
cmd.append('-l')
if home is not None: if home is not None:
cmd.extend(['-d', home]) cmd.extend(['-d', home])

View File

@ -221,7 +221,8 @@ def present(name,
win_homedrive=None, win_homedrive=None,
win_profile=None, win_profile=None,
win_logonscript=None, win_logonscript=None,
win_description=None): win_description=None,
nologinit=False):
''' '''
Ensure that the named user is present with the specified properties Ensure that the named user is present with the specified properties
@ -274,6 +275,13 @@ def present(name,
Additionally, parent directories will *not* be created. The parent Additionally, parent directories will *not* be created. The parent
directory for ``home`` must already exist. directory for ``home`` must already exist.
nologinit : False
If set to ``True``, it will not add the user to lastlog and faillog
databases.
.. note::
Not supported on Windows or Mac OS.
password password
A password hash to set for the user. This field is only supported on A password hash to set for the user. This field is only supported on
Linux, FreeBSD, NetBSD, OpenBSD, and Solaris. If the ``empty_password`` Linux, FreeBSD, NetBSD, OpenBSD, and Solaris. If the ``empty_password``
@ -635,6 +643,7 @@ def present(name,
'workphone': workphone, 'workphone': workphone,
'homephone': homephone, 'homephone': homephone,
'createhome': createhome, 'createhome': createhome,
'nologinit': nologinit,
'loginclass': loginclass} 'loginclass': loginclass}
else: else:
params = ({'name': name, params = ({'name': name,