Files
chef/site-cookbooks/kosmos_blossom/recipes/nginx.rb

29 lines
739 B
Ruby

#
# Cookbook Name:: kosmos_blossom
# Recipe:: nginx
#
domain = node['blossom']['domain']
blossom_node = search(:node, 'role:blossom').first
if blossom_node.nil?
Chef::Log.warn("No node found with 'blossom' role. Not configuring nginx site.")
return
end
tls_cert_for domain do
auth 'gandi_dns'
action :create
end
openresty_site domain do
template 'nginx_conf_blossom.erb'
variables domain: domain,
upstream_host: blossom_node['knife_zero']['host'],
upstream_port: node['blossom']['port'],
max_size_mb: node['blossom']['max_size'] / 1024 / 1024,
ssl_cert: "/etc/letsencrypt/live/#{domain}/fullchain.pem",
ssl_key: "/etc/letsencrypt/live/#{domain}/privkey.pem"
end