I know I'm missing something very basic, but I've been beating my head on this for hours now without making progress. I'm trying to 'tag' nodes with various values, to be pulled later in some home-grown modules. For instance, I want to mark machines as being a webserver, and then in my yum repo module, I have a template that checks for webservers and adds a custom repo if true. I'm very flexible in the details - I don't care if it's a custom variable, a tag, a fact, whatever. The only thing I *don't* want to do is use inheritance and groups to do this - any given machine will be tagged with various different things, and trying to maintain groups would quickly become unmanageable. And unfortunately, this isn't something that can be discovered automatically using facter, at least as far as I can tell.
An example of a failed attempt would be (all files stripped down, but
the meat is there):
nodes.pp:
import "modules"
import groups/*
import roles/*
node 'admin01.dev.example.com' inherits admin { include webserver }
roles/webserver.pp:
class webserver {
$webserver = true
}
templates/repo.erb:
The value of the variable is <%= $webserver::webserver %>.
I also tried $::webserver (after moving it out of the class definition),
$webserver, setting a tag in the class and then reading out the defined
tags, and more. But that should give you guys an idea of what I'm
aiming to do.
Thanks for any pointers!
David
signature.asc
Description: Digital signature
