Ruby 使用chef的SSL证书条件检查

Ruby 使用chef的SSL证书条件检查,ruby,ssl,iis,chef-infra,Ruby,Ssl,Iis,Chef Infra,我正在编写一个chef代码,该代码使用pfx文件将证书导入个人存储,并在IIS中添加https绑定和ssl证书。我成功地使用了代码,代码如下所示 但是,在运行这些步骤之前,我想进行一个条件检查,即如果IIS上的https绑定上已有ssl证书,我不想运行以下任何脚本 你能帮我看一下第一行关于如何查看SSL是否已经安装的“IF”语句吗 # Import certificates to local machine personal store windows_certificate 'cert.pfx

我正在编写一个chef代码,该代码使用pfx文件将证书导入个人存储,并在IIS中添加https绑定和ssl证书。我成功地使用了代码,代码如下所示

但是,在运行这些步骤之前,我想进行一个条件检查,即如果IIS上的https绑定上已有ssl证书,我不想运行以下任何脚本

你能帮我看一下第一行关于如何查看SSL是否已经安装的“IF”语句吗

# Import certificates to local machine personal store
windows_certificate 'cert.pfx' do  
    pfx_password    '@password'  
end

#Setup a HTTPS port on IIS
iis_site 'Default Web Site' do  
  action :config  
  bindings 'http/*:80:,https/*:443:'  
end

#Add the certificate to the IIS 
windows_certificate_binding 'ssl certificate name' do  
  address '0.0.0.0'  
end

您想要的是使用通知:

# Import certificates to local machine personal store
windows_certificate 'cert.pfx' do  
    pfx_password    '@password'
    notifies :config, 'iis_site[Default Web Site]'
end

#Setup a HTTPS port on IIS
iis_site 'Default Web Site' do  
  action :nothing  
  bindings 'http/*:80:,https/*:443:'  
end
或者类似的。当且仅当每个资源“更新”时(其中“更新”对于不同的资源意味着不同的事情),每个资源都将发送配置的通知操作