firewall { '018 accept TCP-1521 from 10.96.0.0/24':
source => '10.96.0.0/24',
dport => [1521],
state => 'NEW',
proto => 'tcp',
action => 'accept',
}
firewall { '018 accept TCP-1521 from 10.32.0.0/11':
source => '10.32.0.0/11',
dport => [1521],
state => 'NEW',
proto => 'tcp',
action => 'accept',
}
firewall { '018 accept TCP-1521 from 10.64.0.0/25':
source => '10.64.0.0/25',
dport => [1521],
state => 'NEW',
proto => 'tcp',
action => 'accept',
}
define profiles::base::firewall_rule ($order = '030',
$dport = undef,
$port = undef,
$proto = 'tcp',
$chain = 'INPUT',
$action = 'accept',
$state = undef,
)
{
if ($dport) {
if ($state) {
firewall { "${order} ${action} ${dport} traffic from ${name}":
source => $name,
dport => $dport,
proto => $proto,
action => $action,
chain => $chain,
state => $state,
}
} else {
firewall { "${order} ${action} ${dport} traffic from ${name}":
source => $name,
dport => $dport,
proto => $proto,
action => $action,
chain => $chain,
}
}
} elsif ($port) {
if ($state) {
firewall { "${order} ${action} ${port} traffic from ${name}":
source => $name,
port => $port,
proto => $proto,
action => $action,
chain => $chain,
}
} else {
firewall { "${order} ${action} ${port} traffic from ${name}":
source => $name,
port => $port,
proto => $proto,
action => $action,
chain => $chain,
state => $state,
}
}
}
}
profiles::base::firewall_rule{ $db_access:
dport => [1521],
state => 'NEW',
}
profiles::banner::database::samplenode::db_access:
- 10.96.0.0/24
- 10.32.0.0/11
- 10.64.0.0/25
require 'spec_helper'
describe "profiles::samplenode" do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts.merge({
:hostname => 'samplenode',
:apptier => 'production',
:clientcert => 'samplenode.example.com',
})
end
it { should create_firewall("030 accept 1521 traffic from 10.96.0.0/24") }
it { should create_firewall("030 accept 1521 traffic from 10.32.0.0/11") }
it { should create_firewall("030 accept 1521 traffic from 10.64.0.0/25") }
end
end
end
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/2d1c3d33-4586-4f2d-bb53-265d45305058%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/2d1c3d33-4586-4f2d-bb53-265d45305058%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.