Hi guys,

I'm trying to get my head around conditionals and variables.

What I'm trying to do now is to distinguish between puppet servers and puppet clients and deliver some settings differently. How can I do that?

I tried to put a variable in the node classes:

    node 'puppet1' {
        $puppetmode = "master",
        include puppetmasterclass
    }
    node 'client1' {
        $puppetmode = "client",
        include puppetclientclass
    }

and then in the classes do something like:

    case $puppetmode {
        "master": {
                $baseurl_base = "file:///puppet/repos"
        }
        "client": {
                $baseurl_base = "http://puppet1/inst";
        }
    }
    class system::repos {
        yumrepo { 'RHEL-5.5-64':
                descr => 'RedHat Enterprise Linux 5.5 64-bit',
                baseurl => "${baseurl_base}/RHEL-5.5-x86_64/Server",
        }
    }

But that doesn't work. Another attempt was to do the "case" statement by hostname wildcard:

    case $hostname {
        "puppet*" {
                $baseurl_base = "..."
        }
    }

but that didn't work either.

It's not only about puppet master/client. I will have to know in some modules in which datacentre a given node is, etc. So was hoping to be able to set a couple of parameters in the node declaration and then work with that in the modules.

Can I somehow pass variables or other tokens around the catalogue and make conditional decisions in other modules based on them?

I'm sure this is something trivial but can't figure out how to do that.

Thanks for any hints!

GiBo





--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to