2024年10月CentOS 5.5如何安装和设置Puppet(2)

 更新时间:2024-10-29

  c.建立puppet目录

  mkdir -p /var/lib/puppet/rrd

  chown puppet.puppet /var/lib/puppet/rrd

  d.启动服务

  /etc/init.d/puppet restart

  e.向server端发送请求命令

  puppetd --test --server server.tech10.com

  到这一步时,总是提示err: Could not retrieve catalog from remote server: certificate verify failed,后来在谷歌上找到解决方法。删除客户端/var/lib/puppet/ssl目录下的文件,再次执行正常

  f.server端用如下命令接受请求

  puppetca -s -a

  g.slave端再次发认证请求

  puppetd -test -server server.tech10.com

  四.puppet的简单应用

  在服务器端的/etc/puppet/manifests下建立site.pp文件,在文件/tmp/andrew.txt内容及权限推送过去

  node default {

  file {“/tmp/andrew.txt”:

  content =》 “hello,My Name is Jone!

  ”,

  ensure =》 present,

  mode =》 644,

  owner =》 root,

  group =》 root,

  }

  }

  present,意思是会检查该文件是否存在,如果不存在,就新建该文件

  客户及执行如下

  puppetd --test --server server.tech10.com

  info: Caching catalog for tech1

  info: Applying configuration version ‘1348711982’

  --- /tmp/andrew.txt 2012-09-27 10:11:18.000000000 +0800

  +++ /tmp/puppet-file.10084.0 2012-09-27 10:13:03.000000000 +0800

  @@ -1 +1,2 @@

  -hello,My Name is Jone!

  No newline at end of file

  +hello,My Name is Jone!

  +hello

  No newline at end of file

  info: FileBucket adding /tmp/andrew.txt as {md5}0578dc72120af9d1ff2ccc6261516d6e

  info: /Stage[main]//Node[default]/File[/tmp/andrew.txt]: Filebucketed /tmp/andrew.txt to puppet with sum 0578dc72120af9d1ff2ccc6261516d6e

  notice: /Stage[main]//Node[default]/File[/tmp/andrew.txt]/content: content changed ‘{md5}0578dc72120af9d1ff2ccc6261516d6e’ to ‘{md5}23d258c42f96b5af34aae4c959995798’

  notice: Finished catalog run in 0.09 seconds

  这是已存在的,在原有基础上发生了改动。

  修改完site.pp文件,要执行/etc/init.d/puppetmaster重启服务。

  上面就是CentOS 5.5安装配置Puppet的方法介绍了,本文详细介绍了Puppet的配置,Puppet在安装完后记得进行相关配置,避免不需要的麻烦。

您可能感兴趣的文章:

相关文章