user 模块是用来创建用户和管理用户设定的,用户可以被设置成 present 状态或者 absent 状态。
fred:
user.present:
- fullname: Fred Jones
- shell: /bin/zsh
- home: /home/fred
- uid: 4000
- gid: 4000
- groups:
- wheel
- storage
- games
testuser:
user.absent
salt.states.user.
absent
(name, purge=False, force=False)¶Ensure that the named user is absent
False
.False
.salt.states.user.
present
(name, uid=None, gid=None, gid_from_name=False, groups=None, optional_groups=None, remove_groups=True, home=None, createhome=True, password=None, hash_password=False, enforce_password=True, empty_password=False, shell=None, unique=True, system=False, fullname=None, roomnumber=None, workphone=None, homephone=None, loginclass=None, date=None, mindays=None, maxdays=None, inactdays=None, warndays=None, expire=None, win_homedrive=None, win_profile=None, win_logonscript=None, win_description=None)¶Ensure that the named user is present with the specified properties
False
.NOTE: If the same group is specified in both "groups" and "optional_groups", then it will be assumed to be required and not optional.
True
.True
.empty_password
argument is set to True
then password
is ignored.
For Windows this is the plain text password.
For Linux, the hash can be generated with openssl passwd -1
.在 0.16.0 版更改: BSD support added.
False
.True
.False
.True
.False
.User comment field (GECOS) support (currently Linux, BSD, and MacOS only):
The below values should be specified as strings to avoid ambiguities when the values are loaded. (Especially the phone and room number fields which are likely to contain numeric data)
在 2014.7.0 版更改: Shadow attribute support added.
Shadow attributes support (currently Linux only):
The below values should be specified as integers.
The below parameters apply to windows only:
The drive letter to use for the home directory. If not specified the home directory will be a unc path. Otherwise the home directory will be mapped to the specified drive. Must be a letter followed by a colon. Because of the colon, the value must be surrounded by single quotes. ie: - win_homedrive: 'U:
在 2015.8.0 版更改.
The custom profile directory of the user. Uses default value of underlying system if not set.
在 2015.8.0 版更改.
The full path to the logon script to run when the user logs in.
在 2015.8.0 版更改.
A brief description of the purpose of the users account.
在 2015.8.0 版更改.