如何使用 Chef 检查和安装 cron

How to check and install cron using chef

全部,

我想检查 cron 是否安装在使用 chef 的服务器上。如果未安装,则应使用 chef 安装。

我写过这样的东西:

 yum_package 'cron' do
       action :install
      end

正在安装cron。安装前如何验证。

您无需验证任何内容。 Chef 足够聪明,知道它不应该安装已经存在的包。

发件人:https://docs.chef.io/resource_examples.html

Get the package from a remote location, but only if the package does not already exist on the target system

如果您想确保安装了特定版本,您可以指定它。详情在这里:https://docs.chef.io/resource_yum.html