From bf33ac997636c4b6c199cfff1e171ffaff437c91 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 13 Nov 2018 00:19:06 -0500 Subject: actually, let's make this shared again --- modules/certbot/manifests/init.pp | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 modules/certbot/manifests/init.pp (limited to 'modules/certbot/manifests/init.pp') diff --git a/modules/certbot/manifests/init.pp b/modules/certbot/manifests/init.pp new file mode 100644 index 0000000..27d59a6 --- /dev/null +++ b/modules/certbot/manifests/init.pp @@ -0,0 +1,54 @@ +class certbot($config_dir=undef) { + if $config_dir { + $_config_dir = $config_dir + } + else { + $_config_dir = "/etc/letsencrypt" + } + + include cron + include nginx + + package { + [ + 'certbot', + 'certbot-nginx', + ]: + ensure => installed; + } + + file { + '/etc/cron.daily/certbot': + content => template('certbot/certbot'), + mode => '0755', + require => [ + Package['certbot'], + Class['cron'], + ]; + "${_config_dir}/renewal-hooks": + ensure => directory, + require => Package['certbot']; + "${_config_dir}/renewal-hooks/deploy": + ensure => directory, + require => File["${_config_dir}/renewal-hooks"]; + "${_config_dir}/renewal-hooks/deploy/reload-cert": + source => 'puppet:///modules/certbot/reload-cert', + require => File["${_config_dir}/renewal-hooks/deploy"]; + "/usr/local/bin/bootstrap-certbot": + source => 'puppet:///modules/certbot/bootstrap-certbot', + mode => '0755'; + } + + exec { "initial certbot run": + provider => shell, + command => "/usr/local/bin/bootstrap-certbot ${config_dir}", + creates => "${_config_dir}/live", + require => [ + Package["certbot"], + # not Class["nginx"], because of circular dependencies with nginx::site + Package["nginx"], + Package["certbot-nginx"], + File['/usr/local/bin/bootstrap-certbot'], + ], + } +} -- cgit v1.2.3-54-g00ecf