[英]Use Puppet user resource in custom type
我正在編寫一個Puppet自定義類型。 這種類型的作用之一是創建和刪除用戶。 我可以做到這一點的一種方法是使用useradd
和userdel
命令。 但是有沒有辦法使用Puppet中已經存在的用戶資源類型來做到這一點? 這似乎是一種更可移植的方法。
您是否正在尋找這樣的東西?
#Defined inside a module name 'testmodule'
#/etc/puppet/modules/testmodule/manifests/userdefine.pp
class testmodule::userdefine ($ensure, $group, $home, $shell) {
user { $name :
ensure => $ensure,
group => $group,
home => $home,
shell => $shell,
}
}
testmodule::userdefine { 'puppet' :
ensure => present,
group => "puppet",
home => "/var/lib/puppet",
shell => "/sbin/nologin",
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.