Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
$ips = false, # an optional list of ip's for each in hosts[]
$clients = [] # list of allowed client ip's # TODO: get from exported resources
) {
$FW = '$FW' # make using $FW in shorewall easier
$fw = '$FW' # make using $FW in shorewall easier
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to use a lowercase varname? Is it required in puppet 4? The reason I left it as caps is that this way the shorewall rules are perfectly readable as folks are used to them.

Copy link
Collaborator Author

@pulecp pulecp Apr 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal of my patch was to fix those errors when you check the code with enabled future parser:

Error: Node inheritance is not supported in Puppet >= 4.0.0. See http://links.puppetlabs.com/puppet-node-inheritance-deprecation at ./modules/gluster/vagrant/puppet/manifests/site.pp:10:22
Error: Node inheritance is not supported in Puppet >= 4.0.0. See http://links.puppetlabs.com/puppet-node-inheritance-deprecation at ./modules/gluster/vagrant/puppet/manifests/site.pp:41:28
Error: Node inheritance is not supported in Puppet >= 4.0.0. See http://links.puppetlabs.com/puppet-node-inheritance-deprecation at ./modules/gluster/vagrant/puppet/manifests/site.pp:108:29
Error: Illegal variable name, The given name 'FW' does not conform to the naming rule /^((::)?[a-z]\w*)*((::)?[a-z_]\w*)$/ at ./modules/gluster/vagrant/puppet/manifests/site.pp:137:2
Error: Illegal variable name, The given name 'FW' does not conform to the naming rule /^((::)?[a-z]\w*)*((::)?[a-z_]\w*)$/ at ./modules/gluster/vagrant/puppet/manifests/site.pp:182:22
Error: Illegal variable name, The given name 'FW' does not conform to the naming rule /^((::)?[a-z]\w*)*((::)?[a-z_]\w*)$/ at ./modules/gluster/vagrant/puppet/manifests/site.pp:183:22
Error: Illegal variable name, The given name 'FW' does not conform to the naming rule /^((::)?[a-z]\w*)*((::)?[a-z_]\w*)$/ at ./modules/gluster/vagrant/puppet/manifests/site.pp:187:23
Error: Illegal variable name, The given name 'FW' does not conform to the naming rule /^((::)?[a-z]\w*)*((::)?[a-z_]\w*)$/ at ./modules/gluster/vagrant/puppet/manifests/site.pp:188:22
Error: Illegal variable name, The given name 'FW' does not conform to the naming rule /^((::)?[a-z]\w*)*((::)?[a-z_]\w*)$/ at ./modules/gluster/vagrant/puppet/manifests/site.pp:189:22
Error: Illegal variable name, The given name 'FW' does not conform to the naming rule /^((::)?[a-z]\w*)*((::)?[a-z_]\w*)$/ at ./modules/gluster/vagrant/puppet/manifests/site.pp:193:15
Error: Found 11 errors. Giving up

So yes, they are not allowed in future versions of puppet.


include gluster::vardir
include gluster::params
Expand Down Expand Up @@ -145,8 +145,8 @@
}
}

if $shorewall {
# XXX: WIP
# XXX: WIP
#if $shorewall {
#if type3x($ips) == 'array' {
# #$other_host_ips = inline_template("<%= ips.delete_if {|x| x == '${ipaddress}' }.join(',') %>") # list of ips except myself
# $source_ips = inline_template("<%= (ips+clients).uniq.delete_if {|x| x.empty? }.join(',') %>")
Expand All @@ -161,18 +161,18 @@
#$nfs_endport = inline_template('<%= 38465+hosts.count %>')
#shorewall::rule { 'gluster-24000':
# rule => "
# ACCEPT ${src} $FW tcp 24009:${endport}
# ACCEPT ${src} $fw tcp 24009:${endport}
# ",
# comment => 'Allow 24000s for gluster',
# before => Service["${::gluster::params::service_glusterd}"],
#}

#if $nfs { # FIXME: TODO
# shorewall::rule { 'gluster-nfs': rule => "
# ACCEPT $(src} $FW tcp 38465:${nfs_endport}
# ACCEPT $(src} $fw tcp 38465:${nfs_endport}
# ", comment => 'Allow nfs for gluster'}
#}
}
#}

# start service only after the firewall is opened and hosts are defined
service { "${::gluster::params::service_glusterd}":
Expand Down
41 changes: 24 additions & 17 deletions vagrant/puppet/manifests/site.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
node default {
# puppetmaster
node puppet {

# this will get put on every host...
$url = 'https://ttboj.wordpress.com/'
file { '/etc/motd':
content => "This is Puppet-Gluster+Vagrant! (${url})\n",
content => "This is Puppet-Gluster+Vagrant! (https://ttboj.wordpress.com/)\n",
}
}

# puppetmaster
node puppet inherits default {

if "${::vagrant_gluster_firewall}" != 'false' {
include firewall
Expand Down Expand Up @@ -38,7 +35,12 @@
}
}

node /^annex\d+$/ inherits default { # annex{1,2,..N}
node /^annex\d+$/ { # annex{1,2,..N}

# this will get put on every host...
file { '/etc/motd':
content => "This is Puppet-Gluster+Vagrant! (https://ttboj.wordpress.com/)\n",
}

if "${::vagrant_gluster_firewall}" != 'false' {
include firewall
Expand Down Expand Up @@ -105,7 +107,12 @@
}
}

node /^client\d+$/ inherits default { # client{1,2,..N}
node /^client\d+$/ { # client{1,2,..N}

# this will get put on every host...
file { '/etc/motd':
content => "This is Puppet-Gluster+Vagrant! (https://ttboj.wordpress.com/)\n",
}

if "${::vagrant_gluster_firewall}" != 'false' {
include firewall
Expand Down Expand Up @@ -134,7 +141,7 @@

class firewall {

$FW = '$FW' # make using $FW in shorewall easier
$fw = '$FW' # make using $FW in shorewall easier

class { '::shorewall::configuration':
# NOTE: no configuration specifics are needed at the moment
Expand Down Expand Up @@ -179,18 +186,18 @@
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
# PORT PORT(S) DEST
shorewall::rule { 'ssh': rule => "
SSH/ACCEPT net $FW
SSH/ACCEPT man $FW
SSH/ACCEPT net $fw
SSH/ACCEPT man $fw
", comment => 'Allow SSH'}

shorewall::rule { 'ping': rule => "
#Ping/DROP net $FW
Ping/ACCEPT net $FW
Ping/ACCEPT man $FW
#Ping/DROP net $fw
Ping/ACCEPT net $fw
Ping/ACCEPT man $fw
", comment => 'Allow ping from the `bad` net zone'}

shorewall::rule { 'icmp': rule => "
ACCEPT $FW net icmp
ACCEPT $FW man icmp
ACCEPT $fw net icmp
ACCEPT $fw man icmp
", comment => 'Allow icmp from the firewall zone'}
}