notify.sina@gmail.com
2014-Feb-10 20:36 UTC
[Puppet Users] puppet 3.4: N00b has Trouble with regexes in a if-else structure manifest config.pp
Hi
I'm probably doing something horribly wrong. I can sense it, but it
hasn't
properly kicked in yet...
I'm trying to create a module for iptables. This is to make servers that
have similar purpose, have the same flrewall configuration.
I created the modules/iptables/{manifests,files,templates} structure, Iike
I have for a few modules I have been able to put together.
For some reason puppet claims not to see the iptables:::config class, which
I have tried to setup in multiple ways, using regexes.
Configuration is like so:
class iptables::config {
## servers with "host" in their name
if $hostname =~ /\w*host+(.*)/ {
## iptables config file
file { "/etc/sysconfig/iptables":
ensure => present,
source =>
"puppet://puppet/modules/iptables/iptables.vmhosts",
mode => 0600,
require => Class["iptables::install"],
notify => Class["iptables::service"],
}
}
## (Anything with "qtm" in its hostname )
elsif $hostname =~ /\S*qtm\D+(.*)/ {
## iptables config file
file { "/etc/sysconfig/iptables":
ensure => present,
source =>
"puppet://puppet/modules/iptables/iptables.qtm",
mode => 0600,
require => Class["iptables::install"],
notify => Class["iptables::service"],
}
}
.......snip...
else {
##The others are custom jobs ( ) so they cant be grouped so easy.
## Working on that...
warning("Coming soon for $hostname")
}
}
The agents all cry "Could not retrieve catalog from remote server: Error
400 on SERVER: Could not find class iptables::config for myname on node me"
Please can some kind person show a poor little beginner what I am doing
wrong?
Thanks!
--
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/c6ef9320-4cdd-4304-9226-b6e590bef89c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.