- 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.
- UI圖標創意設計
- Microsoft Exchange Server PowerShell Cookbook(Third Edition)
- Drupal 8 Blueprints
- Android Jetpack開發:原理解析與應用實戰
- Angular UI Development with PrimeNG
- JavaScript Unlocked
- MongoDB for Java Developers
- 數據結構與算法JavaScript描述
- SQL Server從入門到精通(第3版)
- Corona SDK Mobile Game Development:Beginner's Guide(Second Edition)
- Oracle實用教程
- 超簡單:用Python讓Excel飛起來(實戰150例)
- Java面向對象程序設計教程
- Apache Kafka 1.0 Cookbook
- Expert Cube Development with SSAS Multidimensional Models