User Resources
The user resource is primarily used to manage the operating system's account number, such as account additions, deletion of changed attributes.
1, user resources commonly used properties
User {' Resource title ':
Name
Ensure
Allowdupe
Comment
Uid
Gid
Groups
Home
Managehome
Manages_expiry
Passowrd
Manages_password_max_age
Manages_password_min_age
Shell
Provider
}
Name: Specify the System account name to create.
ensure: Set account increase and deletion, present means add account, absent means delete account.
Allowdupe: whether to allow duplicate UID, set false to indicate that the same UID cannot be set, false by default.
Comment: Description of the account.
UID: If not set, the system will automatically assign UID.
GID: Can be a number or a group name.
Groups: The main set of additional groups, such as [' group1 ', ' group2 '].
Home: The host directory of the system account, which needs to be created in advance.
Managehome: whether to manage their home directory when managing users.
manages_expiry: Manage user Expiration time.
PASSOWRD: System account password.
Shell: The user's shell.
provider:
AIX---User management for AIX.
DirectoryService---Use directory services on OS X for user management.
Hpuxuseradd---HP-UX user management.
LDAP---User management through LDAP.
PW---User management via PW on the FreeBSD platform.
User_role_add---Solaris User and role management.
Useradd---Through the useradd user management, add you to password management, you need to install Ruby Shadow password library, is generally ruby-libshadow.
WINDOWS_ADSI---Use local user management on the Windows platform.
2. User Resource case
Add the test account to the Linux system via the user resource, and we'll have the password.
# OpenSSL Passwd-1
Password:
Verifying-password:
$1$8xseslm.$2l5ib6ohvwxpibeypmr8c.
Continue editing/etc/puppet/manifests/user.pp and add the following:
User {' Test ':
UID = ' 501 ',
Home = '/home/test ',
Password = ' $1$8xseslm.$2l5ib6ohvwxpibeypmr8c. ',
Shell = '/bin/bash ',
}
file {'/home/test ':
ensure = Directory,
Group = ' 501 ',
Owner = ' 501 ',
mode = ' 700 ',
}
Then perform the test
# Puppet Apply User.pp
NOTICE:/stage[main]//user[test]/ensure:created
NOTICE:/stage[main]//file[/home/test]/ensure:created
notice:finished catalog run in 0.04 seconds
please pay attention to http://www.wzlinux.com:45 and http://www.wzlinux.com .
This article is from the "Small Drops Linux" blog, make sure to keep this source http://wangzan18.blog.51cto.com/8021085/1685628
Puppet Advanced Guide--user Resources detailed