- Puppet 5 Essentials(Third Edition)
- Martin Alfke Felix Frank
- 267字
- 2021-07-02 18:22:23
The user and group types
Especially in the absence of central registries, such as LDAP, it is useful to be able to manage user accounts on each of your machines. There are providers for all supported platforms; however, the available attributes vary. On Linux, the useradd provider is the most common. It allows the management of all fields in /etc/passwd, such as uid and shell, and also group memberships:
group { 'proxy-admins':
ensure => present,
gid => 4002,
}
user { 'john':
ensure => present,
uid => 2014,
home => '/home/john',
managehome => true, # <- adds -m to useradd
gid => 1000,
shell => '/bin/zsh',
groups => [ 'proxy-admins' ],
}
As with all resources, Puppet will not only make sure that the user and group exist, but also fix any divergent properties, such as the home directory.
Even though the user depends on the group: (because it cannot be added before the group exists), it need not be expressed in the manifest. The user automatically requires all necessary groups, similar to a file auto-requiring its parent directory.
It was mentioned earlier that there are different attributes available, depending on the operating system. Linux (and the useradd provider) support setting a password, whereas on HP-UX (using the hp-ux provider), the user password cannot be set via Puppet.
In this case, Puppet will only show a warning saying that the user resource type is making use of an unsupported attribute, and will continue managing all other attributes. In other words, using an unsupported attribute in your Puppet DSL code will not break your Puppet run.
- 零基礎玩轉區塊鏈
- AIRAndroid應用開發實戰
- Python數據挖掘與機器學習實戰
- Mastering JBoss Enterprise Application Platform 7
- Nginx實戰:基于Lua語言的配置、開發與架構詳解
- Developing SSRS Reports for Dynamics AX
- SpringBoot從零開始學(視頻教學版)
- DB2SQL性能調優秘笈
- Mastering Leap Motion
- Python編程快速上手2
- Java面試一戰到底(基礎卷)
- ASP.NET Core 2 High Performance(Second Edition)
- Laravel 5.x Cookbook
- Selenium Essentials
- Android Application Programming with OpenCV 3