rwr3211 发表于 2014-11-14 11:14:12

Puppet安装(三):查看信息及测试

一、查看信息
1、查看puppet版本

1
2
# puppet --version
3.7.1




2、查看模块位置

1
2
# puppet config print modulepath
/etc/puppet/modules:/usr/share/puppet/modules




3、查看报告

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# puppet agent -t --summarize
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for puppet.ewin.com
Info: Applying configuration version '1415922617'
Notice: Finished catalog run in 0.07 seconds
Changes:
Events:
Resources:
            Total: 8
Time:
       Filebucket: 0.00
             File: 0.00
         Schedule: 0.00
   Config retrieval: 0.41
            Total: 0.41
         Last run: 1415929219
Version:
         Config: 1415922617
         Puppet: 3.7.1




4、查看客户端更新间隔

1
2
# puppet agent --configprint runinterval
1800




默认1800秒,即半小时,更新间隔可修改puppet.conf

1
runinterval = 120




5、查看请求证书

1
# ls /var/lib/puppet/ssl/ca/requests/




6、查看已签证书

1
2
3
# ls /var/lib/puppet/ssl/ca/signed/
centostest.ewin.com.pemywzhou-pc.ewin.com.pem
puppet.ewin.com.pem      zabbix.ewin.com.pem




7、服务端查看证书

1
2
3
4
# puppet cert list --all
+ "puppet.ewin.com"       (SHA256) 72:FD:30:87:86:CD:3E:CB:F4:6D:2A:C9:22:95:15:9B:48:C6:82:94:76:47:E0:08:57:A9:89:35:40:64:CB:F2 (alt names: "DNS:puppet", "DNS:puppet.ewin.com")
+ "ywzhou-pc.ewin.com"    (SHA256) 29:33:6F:64:7D:98:87:FA:FB:B4:4C:E1:0B:BE:89:AB:F0:3A:3A:DA:29:11:C8:87:83:6C:4E:87:91:0E:F8:9E
+ "zabbix.ewin.com"       (SHA256) 6F:1E:2B:46:2D:31:95:A2:71:59:A3:73:C4:A7:53:4B:29:91:72:65:4A:0D:32:A7:F1:6A:86:B6:D1:4A:FF:2D





二、验证测试
1、服务端编写代码

1
2
3
4
5
6
7
8
9
10
11
12
# vi /etc/puppet/manifests/site.pp
node default {
case $operatingsystem {
    Windows: {
      $file_path = 'C:\helloworld.txt'
    }
    /(RedHat|CentOS|Fedora|Ubuntu|Debian)/: {
      $file_path = '/tmp/helloworld.txt'
    }
}
    file { $file_path : content => "hello, world";}
}




说明:设置默认节点配置,完成安装一、二后,通过参数$operatingsystem自动判断客户端系统,生成相应的helloworld.txt测试文件,并通过content定义内容。
2、客户端测试

1
# puppet agent --server puppet.ewin.com --test









结论:可以看到两个客户端分别生成了文件,内容也是puppet定义好的;
将文件删除,到达下一个同步时间,文件又会自动生成,测试安装成功。
页: [1]
查看完整版本: Puppet安装(三):查看信息及测试