Backup scenarios first, backup recovery via custom Facter with element backup
First, Facter deployment
1. Create directory structure
[Root@puppetserver modules]# Mkdirpublic/{modules,manifests,files,lib/facter}-P
2, open the plug-in function in the module
[Root@puppetserver public]# vim/etc/puppet/puppet.conf
[Main]
Pluginsync = True
3. Write Custom 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, the establishment of environmental variables (test)
[Root@puppetserver public]# Exportfacterlib=/etc/puppet/modules/public/lib/facter
5, test fact (if not normal, will display debugging information)
[Root@puppetserver puppet]# Facterbackup_date
201307241552
6, the client to see if the facter is downloaded into effect
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 16:13backup_date.rb
[Root@agent1 ssh]#