puppet-linux运维
etc /sysconfig/network# hostname
test.rhce.cc
# vi /etc/hosts
# cat /etc/hosts
127.0.0.1localhost.localdomainlocalhost.localdomainlocalhost4localhost4.localdomain4localhosttest
::1localhost.localdomainlocalhost.localdomainlocalhost6localhost6.localdomain6localhosttest
192.168.1.62 test.rhce.cc test
192.168.1.63 rhel.rhce.cc rhel
# scp /etc/hosts 192.168.1.65:/etc/
#yum install createrepo -y
# createrepo -v puppet
# cat /etc/yum.repos.d/aa.repo
name=aa
baseurl=file:///mnt
enabled=1
gpgcheck=0
name=aa
baseurl=file:///root/puppet
enabled=1
gpgcheck=0
# rsync -za puppet node63:~
# rsync -za /etc/yum.repos.d/aa.repo node63:/etc/yum.repos.d/
# yum list puppet\*
# yum install -y puppet\*
# yum list puppet facter
# yum install -y puppet
配置服务端
# cd /etc/puppet/
# vim puppet.conf
添加
1
2 certname=node62.xg.cn
启动puppet
# puppet master
# netstat -ntulp |grep 8140
tcp 0 0 0.0.0.0:8140 0.0.0.0:* LISTEN 3192/ruby
# ls /var/lib/puppet/
bucketfactslibreportsrrdserver_datasslstateyaml
客户端发送请求
oot@node63 ~]# puppet agent --server=node62.xg.cn --no-daemonize --verbose
服务端查看
# ls /var/lib/puppet/ssl/ca/requests/
node63.xg.cn.pem
# puppet cert --list
"node63.xg.cn" (60:D3:89:3A:0A:0F:7E:46:C0:38:FA:5E:53:3E:D4:CF)
签发证书
# 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'
# ls /var/lib/puppet/ssl/ca/signed/
node62.xg.cn.pemnode63.xg.cn.pem
# cd manifests/
# ll
总用量 0
# vim site.pp
1 $puppetserver="node62.xg.cn"
2 import 'node.pp'
~
# vim node.pp
1 node 'node63.xg.cn' {
2 package {"system-config-lvm": ensure=>'installed'} 安装,卸载安装包
3 }
# cat site.pp
$puppetserver="node62.xg.cn"
import 'node.pp'
# puppet agent --server=node62.xg.cn --no-daemonize --verbose --onetime
info: Caching catalog for node63.xg.cn
info: Applying configuration version '1436251741'
notice: /Stage//Node/Package/ensure: created
notice: Finished catalog run in 47.25 seconds
创建文件
# 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 }
# puppet agent --server=node62.xg.cn --no-daemonize --verbose --onetime
info: Caching catalog for node63.xg.cn
info: Applying configuration version '1436252961'
notice: /Stage//Node/File/ensure: created
notice: Finished catalog run in 0.34 seconds
# ls
aa1.txt install.log puppet模板图片下载桌面
anaconda-ks.cfginstall.log.syslog公共的视频文档音乐
# 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"} 创建目录
页:
[1]