我正在制作一个使用pfx文件将证书导入个人商店的厨师代码,并在IIS中添加https绑定并添加ssl证书。我成功使用了代码,代码如下所示。
但是我想在运行这些步骤之前进行条件检查,即如果ssl证书已经在IIS上的https绑定上可用,我不想运行以下任何脚本。
你能帮助我解决第一条“IF'关于如何查看SSL是否已安装的声明?
# 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
答案 0 :(得分:0)
您想要的是使用通知:
# 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
或类似的东西。当且仅当它被“更新”时(每个资源更新意味着不同资源的不同内容),每个资源都会发出配置的通知操作。