default_action :create
property :name, String
-property :domains, Array, :required => true
-property :fallback_certificate, String
+property :domains, [String, Array], :required => true
action :create do
node.default[:letsencrypt][:certificates][name] = {
- :domains => domains
+ :domains => Array(domains)
}
if letsencrypt
mode 0o444
content certificate
backup false
+ manage_symlink_source false
+ force_unlink true
end
file "/etc/ssl/private/#{name}.key" do
mode 0o440
content key
backup false
- end
- elsif fallback_certificate
- link "/etc/ssl/certs/#{name}.pem" do
- to "#{fallback_certificate}.pem"
- end
-
- link "/etc/ssl/private/#{name}.key" do
- to "#{fallback_certificate}.key"
+ manage_symlink_source false
+ force_unlink true
end
else
template "/tmp/#{name}.ssl.cnf" do
owner "root"
group "root"
mode 0o644
- variables :domains => new_resource.domains
+ variables :domains => Array(new_resource.domains)
not_if do
::File.exist?("/etc/ssl/certs/#{new_resource.name}.pem") && ::File.exist?("/etc/ssl/private/#{new_resource.name}.key")
end