Puppet group资源介绍(二十三)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Puppet group资源介绍(二十三)相关的知识,希望对你有一定的参考价值。
group资源
group的主要功能是管理系统组,包含组的名字、增/减组、组成员、组的gid等.
group { ‘资源标题‘: allowdupe ensure gid members name allowdupe provider }
allowdupe:是否允许系统存在同样的gid,false表示不允许设置相同的gid,true表示可以设置相同的gid.
ensure:创建或者删除,设置absent为删除组,设置present为创建组.
gid:设置组的gid,必须是数字,如果不指定,将自动分配,不同的系统自动分配的算法不一样,不推荐使用自动分配gid.
members:该组的成员.
name:该用户组的名字,默认与标题相同.
allowdupe:准许使用相同的gid,默认为false.
provider:支持的系统添加命令.
创建"meng"组的puppet代码:
[[email protected] ~]# cat groupmeng.pp group {‘meng‘: ensure => present, gid => ‘701‘, }
运行结果:
[[email protected] ~]# puppet apply groupmeng.pp Notice: Compiled catalog for sh-web1.localdomain in environment production in 0.06 seconds Notice: /Stage[main]/Main/Group[meng]/ensure: created Notice: Finished catalog run in 0.08 seconds
查看是否创建:
[[email protected] ~]# cat /etc/group | grep meng meng:x:701:
删除"meng"组:
[[email protected] ~]# puppet apply groupmeng.pp Notice: Compiled catalog for sh-web1.localdomain in environment production in 0.06 seconds Notice: /Stage[main]/Main/Group[meng]/ensure: removed Notice: Finished catalog run in 0.06 seconds [[email protected] ~]# cat /etc/group | grep meng [[email protected] ~]#
问题:members参数,puppet3.8 members参数配置不成功,做过的尝试?
1、member后面跟系统已存在的组,发现不行没成功,不存在的组也不成功,官网给的解释没怎么看懂?
官网链接:https://puppet.com/docs/puppet/5.2/types/group.html#group-attribute-members
members
The members of the group. For platforms or directory services where group membership is stored in the group objects, not the users. This parameter’s behavior can be configured with auth_membership.
members参数:组成员存储在某个平台或者目录服务的组对象中,需要参数auth_membership.
[[email protected] ~]# cat groupmeng.pp group {‘meng‘: ensure => present, gid => ‘5560‘, auth_membership => yes, members => [‘wangwu‘,‘lisi‘], }
[[email protected] ~]# puppet apply groupmeng.pp Notice: Compiled catalog for sh-web1.localdomain in environment production in 0.06 seconds Notice: /Stage[main]/Main/Group[meng]/ensure: created Notice: Finished catalog run in 0.05 seconds [[email protected] ~]# cat /etc/group group group- [[email protected] ~]# cat /etc/group | grep meng meng:x:5560:
本文出自 “青衫解衣” 博客,请务必保留此出处http://215687833.blog.51cto.com/6724358/1972900
以上是关于Puppet group资源介绍(二十三)的主要内容,如果未能解决你的问题,请参考以下文章