etc /sysconfig/network
[root@RHEL62 ~]# hostname
test.rhce.cc
[root@RHEL62 ~]# vi /etc/hosts
[root@RHEL62 ~]# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost.localdomain localhost4 localhost4.localdomain4 localhost test
::1 localhost.localdomain localhost.localdomain localhost6localhost6.localdomain6 localhost test
192.168.1.62 test.rhce.cc test
192.168.1.63 rhel.rhce.cc rhel
[root@RHEL62 ~]# scp /etc/hosts 192.168.1.65:/etc/
[root@node62 桌面]# yum install createrepo -y
[root@node62 ~]# createrepo -v puppet
[root@node62 ~]# cat /etc/yum.repos.d/aa.repo
[aa]
name=aa
baseurl=file:///mnt
enabled=1
gpgcheck=0
[puppet]
name=aa
baseurl=file:///root/puppet
enabled=1
gpgcheck=0
[root@node62 ~]# rsync -za puppet node63:~
[root@node62 ~]# rsync -za /etc/yum.repos.d/aa.repo node63:/etc/yum.repos.d/
[root@node62 ~]# yum list puppet\*
[root@node62 ~]# yum install -y puppet\*
[root@node63 ~]# yum list puppet facter
[root@node63 ~]# yum install -y puppet
配置服务端
[root@node62 ~]# cd /etc/puppet/
[root@node62 puppet]# vim puppet.conf
添加
1 [master]
2 certname=node62.xg.cn
启动puppet
[root@node62 puppet]# puppet master
[root@node62 puppet]# netstat -ntulp |grep 8140
tcp 0 0 0.0.0.0:8140 0.0.0.0:* LISTEN 3192/ruby
[root@node62 puppet]# ls /var/lib/puppet/
bucket facts lib reports rrd server_data ssl state yaml
客户端发送请求
oot@node63 ~]# puppet agent --server=node62.xg.cn --no-daemonize --verbose
服务端查看
[root@node62 puppet]# ls /var/lib/puppet/ssl/ca/requests/
node63.xg.cn.pem
[root@node62 puppet]# puppet cert --list
"node63.xg.cn" (60:D3:89:3A:0A:0F:7E:46:C0:38:FA:5E:53:3E:D4:CF)
签发证书
[root@node62 puppet]# puppet cert --sign node63.xg.cn
notice: Signed certificate request for node63.xg.cn
notice: Removing file Puppet::SSL::CertificateRequest node63.xg.cn at '/var/lib/puppet/ssl/ca/requests/node63.xg.cn.pem'
[root@node62 puppet]# ls /var/lib/puppet/ssl/ca/signed/
node62.xg.cn.pem node63.xg.cn.pem
[root@node62 puppet]# cd manifests/
[root@node62 manifests]# ll
总用量 0
[root@node62 manifests]# vim site.pp
1 $puppetserver="node62.xg.cn"
2 import 'node.pp'
~
[root@node62 manifests]# vim node.pp
1 node 'node63.xg.cn' {
2 package {"system-config-lvm": ensure=>'installed'} 安装,卸载 安装包
3 }
[root@node62 manifests]# cat site.pp
$puppetserver="node62.xg.cn"
import 'node.pp'
[root@node63 ~]# puppet agent --server=node62.xg.cn --no-daemonize --verbose --onetime
info: Caching catalog for node63.xg.cn
info: Applying configuration version '1436251741'
notice: /Stage[main]//Node[node63.xg.cn]/Package[system-config-lvm]/ensure: created
notice: Finished catalog run in 47.25 seconds
创建文件
[root@node62 manifests]# vim node.pp
1 node 'node63.xg.cn' {
2 package {"system-config-lvm": ensure=>'absent'}
3 file {"/root/aa1.txt":
4 ensure=>"present",
5 mode=>"0000"
6 }
7 }
[root@node63 ~]# puppet agent --server=node62.xg.cn --no-daemonize --verbose --onetime
info: Caching catalog for node63.xg.cn
info: Applying configuration version '1436252961'
notice: /Stage[main]//Node[node63.xg.cn]/File[/root/aa1.txt]/ensure: created
notice: Finished catalog run in 0.34 seconds
[root@node63 ~]# ls
aa1.txt install.log puppet 模板 图片 下载 桌面
anaconda-ks.cfg install.log.syslog 公共的 视频 文档 音乐
[root@node62 manifests]# vim node.pp
1 node 'node63.xg.cn' {
2 package {"system-config-lvm": ensure=>'absent'}
3 file {"/root/aa1.txt":
4 ensure=>"present",
5 mode=>"0000"
6 }
7 file {"/root/grub.conf": ensure=>"link", target=>"/boot/grup/grub.conf"} 创建软连接 absent删除
8
9 }
~
file {"/root/aa1": ensure=>"directory"} 创建目录