官术网_书友最值得收藏!

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.

Puppet will also happily manage your LDAP user accounts.

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.

主站蜘蛛池模板: 昌都县| 中阳县| 南皮县| 东乌珠穆沁旗| 海盐县| 霍林郭勒市| 剑河县| 缙云县| 景宁| 公安县| 彭水| 长寿区| 阜新| 芦山县| 正定县| 景德镇市| 浑源县| 抚松县| 阳春市| 炉霍县| 德令哈市| 深圳市| 大理市| 西宁市| 大英县| 化隆| 镇赉县| 内丘县| 丰原市| 北京市| 教育| 隆尧县| 中阳县| 怀柔区| 美姑县| 蒙阴县| 得荣县| 芜湖市| 久治县| 东平县| 沽源县|