2024-10-04 15:33:49 +00:00
|
|
|
# Configure a SUNET CDN mqtt server
|
2024-10-04 15:43:31 +00:00
|
|
|
class cdn::mqtt(
|
2024-10-06 12:26:10 +00:00
|
|
|
String $dc = '',
|
2024-10-06 12:30:51 +00:00
|
|
|
Array[String] $clients = [],
|
2024-10-06 12:26:10 +00:00
|
|
|
Hash[String, Hash] $bridges = {},
|
2024-10-09 10:13:30 +00:00
|
|
|
Hash[String, String] $acme_url = {
|
|
|
|
test => 'https://internal-sto3-test-ca-1.cdn.sunet.se:9000/acme/acme/directory'
|
|
|
|
}
|
2024-10-04 15:33:49 +00:00
|
|
|
)
|
|
|
|
{
|
2024-10-09 10:13:30 +00:00
|
|
|
include sunet::packages::certbot
|
|
|
|
|
2024-10-04 15:33:49 +00:00
|
|
|
package {'mosquitto': ensure => installed }
|
2024-10-06 12:26:10 +00:00
|
|
|
|
|
|
|
file { '/etc/mosquitto/aclfile':
|
|
|
|
ensure => file,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0644',
|
2024-10-06 12:32:17 +00:00
|
|
|
content => template('cdn/mqtt/aclfile.erb'),
|
2024-10-06 12:26:10 +00:00
|
|
|
}
|
2024-10-06 12:51:55 +00:00
|
|
|
|
|
|
|
file { '/etc/mosquitto/conf.d/cdn.conf':
|
|
|
|
ensure => file,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0644',
|
|
|
|
content => template('cdn/mqtt/cdn.conf.erb'),
|
|
|
|
}
|
2024-10-08 14:38:11 +00:00
|
|
|
|
2024-10-09 10:13:30 +00:00
|
|
|
sunet::nftables::allow { 'allow-step-ca-acme':
|
2024-10-08 14:38:11 +00:00
|
|
|
from => 'any',
|
|
|
|
port => 80,
|
|
|
|
proto => 'tcp',
|
|
|
|
}
|
2024-10-09 10:13:30 +00:00
|
|
|
|
|
|
|
# From https://wiki.sunet.se/display/sunetops/Platform+naming+standards
|
|
|
|
$my_fqdn = $facts['networking']['fqdn']
|
|
|
|
$dot_split = split($my_fqdn, '[.]')
|
|
|
|
$my_hostname = $dot_split[0]
|
|
|
|
$dash_split = split($my_hostname,'[-]')
|
|
|
|
$environment = $dash_split[2]
|
|
|
|
|
2024-10-10 08:13:04 +00:00
|
|
|
file { '/etc/letsencrypt/renewal-hooks/deploy/sunet-cdn-mqtt':
|
|
|
|
ensure => file,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0755',
|
|
|
|
content => file('cdn/mqtt/sunet-cdn-mqtt'),
|
|
|
|
}
|
|
|
|
|
2024-10-09 10:13:30 +00:00
|
|
|
exec { "certbot certonly -n --email patlu@sunet.se --no-eff-email --agree-tos --standalone -d ${my_fqdn} --server ${acme_url[$environment]}":
|
2024-10-10 08:13:04 +00:00
|
|
|
creates => "/etc/letsencrypt/live/${my_fqdn}/fullchain.pem"
|
2024-10-09 10:13:30 +00:00
|
|
|
}
|
2024-10-04 15:33:49 +00:00
|
|
|
}
|