summaryrefslogtreecommitdiffstats
path: root/modules/certbot/manifests/init.pp
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-11-13 00:19:06 -0500
committerJesse Luehrs <doy@tozt.net>2018-11-13 00:19:06 -0500
commitbf33ac997636c4b6c199cfff1e171ffaff437c91 (patch)
tree2f3d94f0ad3fddde69fec83c4d65356d60dea479 /modules/certbot/manifests/init.pp
parentb5fe67cdda8f05ffe814a923b1a69f7169b9db5c (diff)
downloadpuppet-tozt-bf33ac997636c4b6c199cfff1e171ffaff437c91.tar.gz
puppet-tozt-bf33ac997636c4b6c199cfff1e171ffaff437c91.zip
actually, let's make this shared again
Diffstat (limited to 'modules/certbot/manifests/init.pp')
-rw-r--r--modules/certbot/manifests/init.pp54
1 files changed, 54 insertions, 0 deletions
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'],
+ ],
+ }
+}