352262 发表于 2018-8-2 10:25:06

puppet资源service详细介绍(附案例)

2.3 客户端agent3测试  
可修改agent3端/etc/rc.d/init.d/sshd进行测试
  
case "$1" in
  
      start)
  
                start
  
                ;;
  
      stop)
  
                stop
  
                ;;
  
      restart)
  
                stop
  
                start
  
                echo "sshd restart stop-start" >>/tmp/sshd_status
  
                ;;
  
      reload)
  
                reload
  
                echo "sshd reload" >>/tmp/sshd_status
  
                ;;
  
测试部分
  
# puppet agent --test
  
info: Retrieving plugin
  
info: Loading facts in /var/lib/puppet/lib/facter/backup_date.rb
  
info: Loading facts in /var/lib/puppet/lib/facter/my_apply1.rb
  
info: Loading facts in /var/lib/puppet/lib/facter/my_apply3.rb
  
info: Loading facts in /var/lib/puppet/lib/facter/my_apply2.rb
  
info: Caching catalog for agent3.kisspuppet.com
  
info: Applying configuration version '1378279503'
  
notice: /File/content:
  
--- /etc/ssh/sshd_config    2013-09-04 15:27:22.177863699 +0800
  
+++ /tmp/puppet-file20130904-19622-yy8g9o-0    2013-09-04 15:29:47.791863671 +0800
  
@@ -5,8 +5,6 @@
  
Protocol 2
  
#AddressFamily any
  

  
-# HostKey for protocol version 1
  
-
  
# Lifetime and size of ephemeral version 1 server key
  
#KeyRegenerationInterval 1h
  
#ServerKeyBits 768
  
info: FileBucket adding {md5}43f5b3f207a1b6fb35e3bd779b83c3f8
  
info: /File: Filebucketed /etc/ssh/sshd_config to main with sum 43f5b3f207a1b6fb35e3bd779b83c3f8
  
notice: /File/content: content changed '{md5}43f5b3f207a1b6fb35e3bd779b83c3f8' to '{md5}df197ccd4957217616b62a82b890ed98'
  
info: /File: Scheduling refresh of Class
  
info: Class: Scheduling refresh of Service
  
info: Class: Scheduling refresh of Service
  
notice: /Service: Triggered 'refresh' from 2 events
  
notice: Finished catalog run in 0.97 seconds
  
# cat /tmp/sshd_status
  
sshd reload   #可以看到服务是reload而不是restart
  
#
页: [1]
查看完整版本: puppet资源service详细介绍(附案例)