File tree Expand file tree Collapse file tree 3 files changed +26
-8
lines changed Expand file tree Collapse file tree 3 files changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -98,4 +98,4 @@ executeCmd "chef-automate config patch ssl_cert.toml"
9898log " Restarting Services"
9999executeCmd " chef-automate restart-services"
100100
101- popd
101+ popd
Original file line number Diff line number Diff line change @@ -82,12 +82,17 @@ def schedule_check
8282 stop_command = new_resource . stop_command
8383
8484 # Use the template to create the script that will be run to renew the certificate
85- filename = ::File . join ( node [ 'camsa' ] [ 'dirs' ] [ 'bin' ] , 'renew_cert.sh' )
86- template filename do
87- source 'renew_cert.sh'
88- variables ( {
89- stop_command : stop_command ,
90- start_command : start_command ,
85+ script_filename = ::File . join ( node [ 'camsa' ] [ 'dirs' ] [ 'bin' ] , 'configure_automate_crt.sh' )
86+ cookbook_file script_filename do
87+ source 'configure_automate_crt.sh'
88+ mode '0755'
89+ end
90+
91+ cron_filename = ::File . join ( node [ 'camsa' ] [ 'dirs' ] [ 'bin' ] , 'cron_ssl_renew.sh' )
92+ template cron_filename do
93+ source 'cron_ssl_renew.sh'
94+ variables ( {
95+ renew_cert_path : script_filename
9196 } )
9297 mode '0755'
9398 end
@@ -100,7 +105,7 @@ def schedule_check
100105 day timing [ 2 ]
101106 month timing [ 3 ]
102107 weekday timing [ 4 ]
103- command filename
108+ command cron_filename
104109 end
105110
106111 end
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # Determine the command to use to stop the service based on what commands
4+ # are installed on the server
5+ if [ -f ' /usr/local/bin/chef-automate' ]
6+ PRE_HOOK=" chef-automate stop"
7+ POST_HOOK=" <%= @renew_cert_path %>"
8+ else
9+ PRE_HOOK=" chef-server-ctl stop nginx"
10+ POST_HOOK=" chef-server-ctl start nginx"
11+ fi
12+
13+ certbot renew --pre-hook " ${PRE_HOOK} " --post-hook " ${POST_HOOK} "
You can’t perform that action at this time.
0 commit comments