三.用戶和組
用戶資源:user
該資源類型用於管理系統用戶,所以缺少一些特性來管理普通用戶.利用 符合POSIX API
參數
Allowdupe:是否允許存在同樣的用戶
Auths:指定用戶擁有的認證方式,多個認證方式可以用數組列出,依賴manages_solaris_rbac
Comment
Ensur:最基本的參數,決定該用戶存在與否,可以設置的值是present,absent,角色
Gid:該用戶的主用戶組的gid.可以用數字或者組名字
Groups:指定該用戶屬於那些組的成員,主組不必要在這裡列出,多個組用數組列出,
Home:用戶的home目錄,這個目錄需要預先存在.
Managehome:管理用戶的時候是否管理用戶的home目錄
Name:該資源的namevar, 用戶名,建議長度小於8,用字母開頭
Passwor:用戶的密碼
Provider:指定用provider,用什麼命令來執行用戶操作,可用的provider有:
Shell:用戶的shell,指定的
Uid:用戶的uid,設置成數字,對於新用戶,如果沒有指定uid,系統將會自動分配
組
參數
Allowdupe:是否允許兩個相同的gid, 這個參數不能在
Ensure:創建或者刪除組,設置absent就刪除該組,設置
Gid:該組的 gid,是數字,如果不指定,將自動分配 ,不同的系統自動分配的演算法不一樣
Members:該組的成員
Name:該用戶組的名字,這是這個資源的namevar
Provider:指定用什麼工具作為
用戶和組測試用例
- group{"hmyt":
- gid=>1001,
- ensure=>present,
- }
- user {"hmyt":
- uid=>1001
, - gid=>1001,
- home=>"/home/hmyt",
- shell=>"/bin/bash",
- password=>"123456",
- }
客戶端測試結果
- [root@client1 ~]# puppetd --server master.puppet --test
- notice: Ignoring --listen on onetime run
- info: Caching catalog for client1.centos
- info: Applying configuration version '1329967264'
- notice: Finished catalog run in 0.02 seconds
檢查客戶端的用戶和組
- [root@client1 ~]# more /etc/group|grep hmyt
- hmyt:x:1001:
- [root@client1 ~]# more /etc/passwd|grep hmyt
- hmyt:x:1001:1001::/home/hmyt:/bin/bash
本文出自 「Waydee的博客」 博客,請務必保留此出處http://waydee.blog.51cto.com/4677242/847122
[火星人 ] Puppet--用戶自動化管理已經有516次圍觀