我正在浏览 Puppet“学习”VM。这是我的清单:
$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)
当我执行 时puppet apply manifest.pp
,它说一切都已创建。我执行 ,cat /etc/shadow
那些用户确实在那里。但执行 'ls /home' 会显示一个目录。
VM 在 Centos 5.7 上运行。Puppet VM 有问题吗?还是我在清单中做错了什么?
答案1
user { "${title}":
ensure => $ensure_val,
comment => "${full_name}",
groups => "student",
home => "/home/${title}",
name => "${title}",
password => "${title}",
shell => "/bin/bash",
managehome => true,
}
尝试将 managehome => true 添加到您的用户资源中,它应该会创建主目录。