puppet 3.x 棄用的一些語法

最近發現puppet 日誌中報警告信息,以下: shell

 puppet puppet-master[17329]: Deprecation notice:  Resource references should now be capitalized on line 21 in file /etc/puppet/environments/production/modules/check_mk/manifests/debian.pp api


通過查看,原來是puppet 3.x 棄用了一些2.7 的寫法,具體以下: ssh


file 與exec 依賴關係

file {"/tmp/check_upgrade.sh":
         mode    => 755,
         owner   => root,
         group   => root,
         source  => "puppet:///check_mk/check_upgrade.sh"
}

 exec {"/tmp/check_upgrade.sh":
        cwd => "/tmp",
        user => root,
        subscribe => File["/tmp/check_upgrade.sh"],
        refreshonly => true, ####若是/tmp/check_upgrade.sh 文件發生變化則執行改shell 文件
  }
棄用原來的以下:
file {"/tmp/check_upgrade.sh":
         source  => "puppet:///check_mk/check_upgrade.sh"
         alias => check,
}
exec {"/tmp/check_upgrade.sh"
          require => File ["check"],
ui

file 與service 之間的關係
   file {"check_mk":
          #notify => service["xinetd"],
          name => "/etc/xinetd.d/check_mk",
          owner => root,
          group => root,
          mode => 0644,
          source => "puppet:///check_mk/check_mk",
          require => Package["xinetd"],    

     }
     service { "xinetd":
          ensure => running,
          enable => true,
          require => Package["xinetd"],
          subscribe=>File [check_mk], ###文件check_mk 變化則reload 服務,不是restart 服務

     }
棄用之前的:
# define the service to restart
service { "sshd":
    ensure  => "running",
    enable  => "true",
    require => Package["openssh-server"],
}

# add a notify to the file resource
file { "/etc/ssh/sshd_config":
    notify  => Service["sshd"],  # this sets up the relationship
    mode    => 600,
    owner   => "root",
    group   => "root",
    require => Package["openssh-server"],
    content => template("ssh/sshd_config.erb"),

} this

http://hi.baidu.com/nessus1/item/5d1012514c82954e4eff20d0 spa

相關文章
相關標籤/搜索