diff options
Diffstat (limited to 'manifests/letsencrypt.pp')
-rw-r--r-- | manifests/letsencrypt.pp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/manifests/letsencrypt.pp b/manifests/letsencrypt.pp index 4b4b568..48aa3a8 100644 --- a/manifests/letsencrypt.pp +++ b/manifests/letsencrypt.pp @@ -1,20 +1,35 @@ class profiles::letsencrypt ( String $certname, - String $nginx_plugin, Array[String] $domains, + Enum['nginx','apache'] $provider, + Optional[String] $nginx_plugin = undef, + Optional[String] $apache_plugin = undef, ) { - ensure_packages ([$nginx_plugin]) - include ::letsencrypt + $plugin = $provider + $post_hook = $provider ? { + 'nginx' => 'systemctl restart nginx.service', + 'apache' => 'systemctl restart apache2.service', + } + + case $provider { + 'apache': { + ensure_packages ([$apache_plugin]) + } + 'nginx': { + ensure_packages ([$nginx_plugin]) + } + } + letsencrypt::certonly { $certname: ensure => present, domains => $domains, manage_cron => true, - plugin => 'nginx', + plugin => $plugin, additional_args => [ '--quiet', ], # pre_hook_commands => [ 'systemctl stop nginx.service', ], - post_hook_commands => [ 'systemctl restart nginx.service', ], + post_hook_commands => [ $post_hook, ], } } |