Skip to content

Instantly share code, notes, and snippets.

@dni
Last active February 8, 2018 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dni/fdadabe288b7c98567e1ad31edde7de5 to your computer and use it in GitHub Desktop.
Save dni/fdadabe288b7c98567e1ad31edde7de5 to your computer and use it in GitHub Desktop.
search("aws_opsworks_app").each do |app|
if app["deploy"]
ssl_conf = "/etc/letsencrypt/live/#{domain}/fullchain.pem"
## works herre
execute "request certificat #{domain}" do
command "certbot --text --non-interactive --email office@dnilabs.com --agree-tos --agree-dev-preview "\
"--authenticator webroot --installer apache -d #{domain} --webroot-path #{document_root}"
not_if { File.exist?(ssl_conf) }
ignore_failure true
end
# ruby_block "check file exists" do
# block do
# enablessl = File.exist?(ssl_conf)
# end
# end
# doesnt work here
template "/etc/apache2/sites-enabled/#{name}.conf" do
source "vhost.conf.erb"
mode "0644"
variables (
:name => name,
:domain => domain,
:domains => domains,
:ssl => lazy { File.exist?(ssl_conf) }
)
end
execute "reload apache" do
command "service apache2 reload"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment