1
0
mirror of https://github.com/krislamo/vagrant-jenkins synced 2024-12-16 13:20:35 +00:00

dynamically manage firewall ports from hiera values

This commit is contained in:
Mark Heiges 2016-12-15 12:31:21 -05:00
parent 630f8b3336
commit 4e51275d6b

View File

@ -11,35 +11,18 @@ class profiles::ebrc_jenkins {
Class['::profiles::local_home'] -> Class['::profiles::local_home'] ->
Class['::ebrc_jenkins'] Class['::ebrc_jenkins']
firewalld::custom_service{ 'Allow jenkins in public zone': $jenkins_instances = hiera('ebrc_jenkins::instances')
short => 'jenkins', $jenkins_instances.each |$instance, $conf| {
port => [ $port = $conf['http_port']
{ firewalld_rich_rule { "Jenkins instance ${instance}":
'port' => 9191, ensure => present,
'protocol' => 'tcp'
},
{
'port' => 9181,
'protocol' => 'tcp'
},
{
'port' => 9130,
'protocol' => 'tcp'
},
{
'port' => 9120,
'protocol' => 'tcp'
},
],
before => Firewalld_service['Allow jenkins in public zone'],
}
firewalld_service {'Allow jenkins in public zone':
ensure => 'present',
zone => 'public', zone => 'public',
service => 'jenkins', port => {
'port' => $port,
'protocol' => 'tcp',
},
action => 'accept',
}
} }
} }