我正在浏览 Puppet“学习”虚拟机。这是我的清单:
$ensure_val = 'present'
define student($full_name) {
user { "${title}":
ensure => $ensure_val,
comment => "${full_name}",
groups => "student",
home => "/home/${title}",
name => "${title}",
password => "${title}",
shell => "/bin/bash",
}
}
$students = {
'elion' => {full_name => "El Lion"},
'azee' => {full_name => "Avery Zee"}
}
create_resources(student, $students)
当我执行 apuppet apply manifest.pp
时,它说一切都已创建。我做了一个cat /etc/shadow
,确实那些用户在那里。但是执行“ls /home”会显示一个目录。
VM 在 Centos 5.7 上运行。puppet VM 有问题吗?或者我在清单中做错了什么?
尝试将 managehome => true 添加到您的用户资源,它应该创建 homedirs。