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

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.

主站蜘蛛池模板: 自治县| 会同县| 乐昌市| 昌平区| 阿图什市| 武威市| 长岛县| 阳高县| 基隆市| 南宁市| 太湖县| 白水县| 浮山县| 白玉县| 高淳县| 马尔康县| 星子县| 银川市| 三门县| 金塔县| 横峰县| 东阿县| 玉溪市| 高阳县| 绥棱县| 北海市| 旬邑县| 景谷| 武邑县| 阿拉善右旗| 祁阳县| 永川市| 哈密市| 大理市| 靖远县| 泾川县| 兴隆县| 凉山| 洛南县| 东莞市| 怀来县|