eid-ops/global/overlay/etc/puppet/modules/eid/manifests/connector.pp

52 lines
2 KiB
Puppet

# This puppet manifest is used to configure Sweden Connect proxy servers
# @param environment The environment that the server belongs to. (referenced in compose file)
# @param session_backend Choose if it should run with a "redis" cluster (session synk) or without session synk
# @param version Version of the docker image to use. (referenced in compose file)
# @param server_fqdn The FQDN of the server. (referenced in compose file)
# @param connector_directory The directory where all connector related config and files are stored. (referenced in compose file)
# @param use_hsm Configure if HSM is used or not
class eid::connector (
Enum['test', 'qa', 'prod'] $environment,
Enum['redis', 'memory'] $session_backend = 'redis',
String $version = '',
#String $connector_hostname = '',
String $server_fqdn = $facts['networking']['fqdn'],
String $connector_directory = '/opt/eidas-connector',
Boolean $use_hsm=true,
) {
if $use_hsm {
$pkcs11_pin = safe_hiera('pkcs11_pin')
}
if $version and $pkcs11_pin != 'NOT_SET_IN_HIERA' {
# Allow HTTPS from load balancer servers
sunet::nftables::allow { 'allow-https-from-lbs':
from => ['94.176.224.38', '94.176.224.166',],
port => 443,
}
# Make sure we create backup directory referenced in compose file
file { "${connector_directory}/backup":
ensure => directory,
mode => '0755',
owner => 'root',
group => 'root',
}
file { "${connector_directory}/application-${environment}.yml":
ensure => 'file',
content => template("eid/connector/application-${environment}.yml.erb")
}
sunet::docker_compose { 'eidas-connector':
content => template('eid/connector/docker-compose.yml.erb'),
service_name => 'eidas-connector',
compose_dir => '/opt/',
compose_filename => 'docker-compose.yml',
description => 'eidas connector'
}
}
}