diff --git a/modules/insidan/manifests/certificates.pp b/modules/insidan/manifests/certificates.pp index 06ddbf201c595f82cd0630798ee7c0df6de344e7..37e46647733d227a2e4f8ab27c7b3d177b03fbc6 100644 --- a/modules/insidan/manifests/certificates.pp +++ b/modules/insidan/manifests/certificates.pp @@ -6,10 +6,12 @@ class insidan::certificates { letsencrypt::certonly { 'insidan.holgerspexet.se': domains => [ 'insidan.holgerspexet.se', 'holgerspexet.lysator.liu.se', - 'holgerspexet.se', - 'www.holgerspexet.se', ], + manage_cron => true, suppress_cron_output => true, - cron_success_command => '/bin/systemctl restart nginx', + cron_hour => '4', + cron_minute => '13', + pre_hook_commands => ['/bin/systemctl stop nginx',], + post_hook_commands => ['/bin/systemctl restart nginx',], } } diff --git a/modules/insidan/manifests/openproject.pp b/modules/insidan/manifests/openproject.pp index c441a34b71982351725964e940265d001cab4d2e..049738250b06932b2b646135043cb7876db5a945 100644 --- a/modules/insidan/manifests/openproject.pp +++ b/modules/insidan/manifests/openproject.pp @@ -41,10 +41,9 @@ class insidan::openproject { - - # Setup Nginx nginx::resource::server { 'insidan.holgerspexet.se': + require => [ Class['::insidan::certificates'], ], server_name => ['insidan.holgerspexet.se'], proxy => 'http://localhost:6000', diff --git a/modules/wordpress/manifests/certificates.pp b/modules/wordpress/manifests/certificates.pp new file mode 100644 index 0000000000000000000000000000000000000000..b31f7ca7bb994939547cfbcf9b4871fe6a458552 --- /dev/null +++ b/modules/wordpress/manifests/certificates.pp @@ -0,0 +1,19 @@ +class wordpress::certificates { + class { '::letsencrypt': + email => 'hx@hx.ax', # Putting in my personal email for now + } + + letsencrypt::certonly { 'holgerspexet.se': + domains => [ 'holgerspexet.se', + 'holgerspexet-public.lysator.liu.se', + 'www.holgerspexet.se', + ], + manage_cron => true, + suppress_cron_output => true, + cron_hour => '4', + cron_minute => '17', + pre_hook_commands => ['/bin/systemctl stop apache',], + post_hook_commands => ['/bin/systemctl restart apache || true',], + # '||true' for initial bootstrap. pls fix + } +} diff --git a/modules/wordpress/manifests/init.pp b/modules/wordpress/manifests/init.pp index 7a1735cbbe01a76ad8d56654514ad24dbb48ea86..128ede56d5f479553da0b43d6fe43555b0ca874c 100644 --- a/modules/wordpress/manifests/init.pp +++ b/modules/wordpress/manifests/init.pp @@ -7,9 +7,12 @@ class wordpress { ensure => directory, } + include wordpress::certificates; + class { 'apache': default_vhost => false, mpm_module => 'prefork', + require => [ Class['::wordpress::certificates'], ], } include apache::mod::rewrite @@ -66,18 +69,5 @@ class wordpress { redirect_status => 'permanent', redirect_dest => 'https://dev.holgerspexet.se', } - - - class { '::letsencrypt': - email => 'hx@hx.ax', # Putting in my personal email for now - } - - letsencrypt::certonly { 'holgerspexet.se': - domains => [ 'holgerspexet.se', - 'holgerspexet-public.lysator.liu.se', - 'www.holgerspexet.se', - ], - suppress_cron_output => true, - cron_success_command => '/bin/systemctl restart nginx', - } } +