add script for creating VM image
This commit is contained in:
parent
9c3189544a
commit
75c3228c5e
8 changed files with 196 additions and 2 deletions
13
lib/certbot.rb
Normal file
13
lib/certbot.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
module Certbot
|
||||
|
||||
def self.create_certificate(domain, wildcard = false)
|
||||
command = "/home/artur/.dat/bin/certbot"
|
||||
if wildcard
|
||||
system "sudo #{command} certonly --manual --preferred-challenges=dns -d \"*.#{domain}\" -d \"#{domain}\""
|
||||
else
|
||||
system "sudo #{command} --nginx -d #{domain}"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -119,6 +119,13 @@ module Execute
|
|||
end
|
||||
end
|
||||
|
||||
def domain(name)
|
||||
require 'certbot'
|
||||
wildcard = name.strip.start_with?("*.")
|
||||
domain = name.strip.delete_prefix("*.")
|
||||
Certbot.create_certificate(domain, wildcard)
|
||||
end
|
||||
|
||||
def user(*users)
|
||||
require 'user'
|
||||
users.each do |name|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue