Skip to content

Commit

Permalink
added automatic firewall confguration for the given
Browse files Browse the repository at this point in the history
  • Loading branch information
leVF91-da0aA authored and leVF91-da0aA committed Jun 6, 2014
1 parent b0f92c6 commit b652c35
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ project_page 'https://github.com/maxchk/puppet-varnish'
dependency 'puppetlabs/stdlib'
dependency 'puppetlabs/concat'
dependency 'puppetlabs/apt'
dependency 'puppetlabs/firewall'
17 changes: 17 additions & 0 deletions manifests/firewall.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Class varnish::firewall
#
# Uses puppetlabs/firewall module to open port 80
#
class varnish::firewall (
$manage_firewall = true,
$varnish_listen_port = '6081',
) {

firewall { '100 allow port 80 to varnish':
chain => 'INPUT',
proto => 'tcp',
state => ['NEW'],
dport => $varnish_listen_port,
action => 'accept',
}
}
9 changes: 8 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,21 @@
$shmlog_tempfs = true,
$version = present,
$add_repo = true,
$manage_firewall = true,
) {

# read parameters
include varnish::params

# install Varnish
class {'varnish::install':
add_repo => $add_repo
add_repo => $add_repo
manage_firewall => $manage_firewall
varnish_listen_port => $varnish_listen_port
}

# add firewall rule for port 80
class {'varnish::firewall':
}

# enable Varnish service
Expand Down
9 changes: 8 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@
#

class varnish::install (
$add_repo = true
$add_repo = true,
$manage_firewall = true,
$varnish_listen_port
) {
class { 'varnish::repo':
enable => $add_repo,
before => Package['varnish'],
}

class { 'varnish::firewall':
enable => $manage_firewall,
varnish_listen_port => $varnish_listen_port,
}

# varnish package
package { 'varnish':
ensure => $varnish::version,
Expand Down

0 comments on commit b652c35

Please sign in to comment.