Wrapp in if clause for nftables

This commit is contained in:
Micke Nordin 2023-02-17 17:03:49 +01:00
parent 20755e1361
commit b132b363cd
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257
2 changed files with 27 additions and 21 deletions

View file

@ -334,14 +334,17 @@ define sunetdrive::app_type (
compose_filename => 'docker-compose.yml', compose_filename => 'docker-compose.yml',
description => 'Nextcloud application', description => 'Nextcloud application',
} }
sunet::misc::ufw_allow { 'https': if $::facts['sunet_nftables_enabled'] == 'yes' {
from => '0.0.0.0/0', sunet::nftables::docker_expose { 'https':
port => 443, allow_clients => ['any'],
} port => 443,
sunet::nftables::docker_expose { 'https': iif => 'ens3',
allow_clients => ['any'], }
port => 443, } else {
iif => 'ens3', sunet::misc::ufw_allow { 'https':
from => '0.0.0.0/0',
port => 443,
}
} }
} }

View file

@ -65,19 +65,22 @@ class sunetdrive::proxysql (
content => template('sunetdrive/proxysql/my.cnf.erb'), content => template('sunetdrive/proxysql/my.cnf.erb'),
mode => '0644', mode => '0644',
} }
sunet::misc::ufw_allow { 'stats_ports': if $::facts['sunet_nftables_enabled'] == 'yes' {
from => $tug_office, sunet::nftables::docker_expose { 'stats_ports':
port => 6080, allow_clients => $tug_office,
} port => 6080,
sunet::nftables::docker_expose { 'stats_ports': iif => 'ens3',
allow_clients => $tug_office, }
port => 6080, sunet::nftables::docker_expose { 'proxysql':
iif => 'ens3', allow_clients => ['any'],
} port => 6032,
sunet::nftables::docker_expose { 'proxysql': iif => 'ens3',
allow_clients => ['any'], }
port => 6032, } else {
iif => 'ens3', sunet::misc::ufw_allow { 'stats_ports':
from => $tug_office,
port => 6080,
}
} }
sunet::docker_compose { 'drive_proxysql_docker_compose': sunet::docker_compose { 'drive_proxysql_docker_compose':