备份方案一、通过自定义facter结合元素backup进行备份恢复
一、facter部署
1、创建目录结构
[root@puppetserver modules]# mkdirpublic/{modules,manifests,files,lib/facter} -p
2、打开模块中的插件功能
[root@puppetserver public]# vim/etc/puppet/puppet.conf
[main]
pluginsync = true
3、编写自定义fact
[root@puppetserver public]# vim/etc/puppet/modules/public/lib/facter/backup_date.rb
# backup_date.rb
#
Facter.add("backup_date") do
setcode do
Facter::Util::Resolution.exec('/bin/date +%Y%m%d%H%M%S')
end
end
4、建立环境变量(测试用)
[root@puppetserver public]# exportFACTERLIB=/etc/puppet/modules/public/lib/facter
5、测试fact(如果不正常,会显示调试信息)
[root@puppetserver puppet]# facterbackup_date
201307241552
6、客户端查看facter是否被下载生效
notice: Starting Puppet client version2.7.21
info: Retrieving plugin
notice:/File[/var/lib/puppet/lib/facter/backup_date.rb]/ensure: defined content as'{md5}91d97be10a35ab7971f77a2be9696031'
info: Loading downloaded plugin/var/lib/puppet/lib/facter/backup_date.rb
info: Loading facts in /var/lib/puppet/lib/facter/backup_date.rb
info: Caching catalog foragent1.bsgchina.com
info: Applying configuration version'1374652447'
notice: Finished catalog run in 1.47seconds
info: Retrieving plugin
info: Loading facts in/var/lib/puppet/lib/facter/backup_date.rb
info: Caching catalog foragent1.bsgchina.com
info: Applying configuration version'1374652447'
notice: Finished catalog run in 1.36seconds
[root@agent1 ssh]# ll/var/lib/puppet/lib/facter/
total 8
-rw-r--r-- 1 root root 138 Jul 24 16:13backup_date.rb
[root@agent1 ssh]#