最近研究了以下puupet,发现在强大了。可以用它来统一管理所有的配置文件,以及统一的增加用户。可以大量的减少系统管理员的时间。据说google就用puppet管理了几千台服务器.
1:首先修改/etc/puppet/fileserver.conf文件增加以下内容: [files] path /var/lib/puppet/files
allow *
这样puppet server就可以作为一个文件服务器来访问了.
2:然后修改/etc/puppet/manifests/site.pp增加以下内容:
class test_class {
user { "zhangqintest": uid => 584,
gid => 511,
password =>'$1$Q4elAs8J$Fdi8GtbxZoHRWAJrmRSa7/',
shell =>"/bin/bash",
managehome=>"ture";}
file { "/home/zhangqintest":
owner => 584,
group => 511,
mode => 700,
ensure => directory;
}
exec { "cp /etc/skel/.* /home/zhangqintest/": cwd => "/tmp",
# creates => "/home/zhangqintest",
path => ["/usr/bin", "/usr/sbin","/bin"]
}
file {"/etc/sudoers":
owner => root,
group => root,
mode => 600,
//需要把提前修改后的文件拷贝到文件服务器的位置
source=> "puppet://puppet/files/sudoers";
}
} # tell puppet on which client to run the class node app,app3{ include test_class } 3:最后再客户端上,等待10分钟(默认)就可以看到增加了zhangqintest用户,并且将这个用户增加到了sudoers文件中。如果不想等,可以直接在客户端执行puppetd --server puppet 此文章由 http://www.ositren.com 收集整理 ,地址为: http://www.ositren.com/htmls/49421.html
1:首先修改/etc/puppet/fileserver.conf文件增加以下内容: [files]
2:然后修改/etc/puppet/manifests/site.pp增加以下内容:
class test_class {
user { "zhangqintest":
file
exec { "cp /etc/skel/.* /home/zhangqintest/":
file
} # tell puppet on which client to run the class node app,app3{ include test_class } 3:最后再客户端上,等待10分钟(默认)就可以看到增加了zhangqintest用户,并且将这个用户增加到了sudoers文件中。如果不想等,可以直接在客户端执行puppetd --server puppet 此文章由 http://www.ositren.com 收集整理 ,地址为: http://www.ositren.com/htmls/49421.html