Switch Certbot to snap package on Ubuntu 20.04+
Needs only minor changes. Tested and running on wiki.kosmos.org already.
This commit is contained in:
@@ -39,10 +39,12 @@ action :create do
|
||||
|
||||
include_recipe "kosmos-base::letsencrypt"
|
||||
|
||||
certbot_bin = node[:platform_version].to_f < 20.04 ? "/usr/bin/certbot" : "/snap/bin/certbot"
|
||||
|
||||
# Generate a Let's Encrypt cert (only if the nginx vhost exists and no cert
|
||||
# has been generated before. The renew cron will take care of renewing
|
||||
execute "letsencrypt cert for #{domain}" do
|
||||
command "/usr/bin/certbot certonly --webroot --agree-tos --email ops@kosmos.org --webroot-path #{root_directory} -d #{domain} -n"
|
||||
command "#{certbot_bin} certonly --webroot --agree-tos --email ops@kosmos.org --webroot-path #{root_directory} -d #{domain} -n"
|
||||
only_if do
|
||||
::File.exist?("#{node['nginx']['dir']}/sites-enabled/#{domain}_certbot") &&
|
||||
!::File.exist?("/etc/letsencrypt/live/#{domain}/fullchain.pem")
|
||||
|
||||
Reference in New Issue
Block a user