Files
confdroid_nagios/manifests/certbot/certs.pp

49 lines
1.3 KiB
ObjectPascal
Raw Normal View History

2017-07-22 12:23:28 +01:00
## cd_nagios::certbot::certs.pp
2017-07-21 15:33:05 +01:00
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages all configuration files required for cd_nagios.
##############################################################################
2017-07-22 12:23:28 +01:00
class cd_nagios::certbot::certs (
2017-07-21 15:33:05 +01:00
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
2017-07-21 16:24:35 +01:00
if $ng_use_https == true {
if $ng_enable_certbot == true {
require cd_certbot
2017-07-22 12:23:28 +01:00
require cd_apache
2017-07-21 15:33:05 +01:00
2017-07-23 11:07:10 +01:00
if $ng_include_fw == true {
require cd_nagios::firewall::iptables
}
2017-07-21 16:24:35 +01:00
# create cert
2017-07-21 15:33:05 +01:00
2017-07-21 16:24:35 +01:00
exec { 'create_cert':
2025-05-12 15:56:17 +02:00
command => template($ng_get_cert_erb),
cwd => '/tmp',
path => ['/bin','/usr/bin'],
provider => 'shell',
unless => template('cd_nagios/certbot/unless_get_cert.erb'),
notify => Service['httpd'],
creates => $ng_certbot_check,
2017-07-21 16:24:35 +01:00
}
2017-07-21 15:33:05 +01:00
2017-07-21 16:24:35 +01:00
# renew certs
2017-07-21 15:33:05 +01:00
2025-05-12 15:56:17 +02:00
exec { 'renew_cert':
command => 'certbot renew',
cwd => '/tmp',
path => ['/bin','/usr/bin','/opt/'],
provider => 'shell',
notify => Service['httpd'],
unless => template($ng_unless_renew_erb),
2017-07-21 16:24:35 +01:00
}
2017-07-21 15:33:05 +01:00
}
}
2017-07-21 16:24:35 +01:00
else {
# do nothing as we are not using https and certbot is not required then
}
2017-07-21 15:33:05 +01:00
}
}