>> We have simple inheritance in our external node classifier like this:
>> We only allow one level, and includes cannot include other includes.
>> Parameters specified in a node yaml override the same parameter in an
>> include yaml.
>> Oh, and we have a default node that all of this is appended to.
>> This is a really simple classifier, less than 100 lines of real code.
>
> I will try to do something like that.

I've just made a small python script that implements a simple external
node manager with inheritance support.

http://gist.github.com/604530

It allows define "includes" to other nodes/definitions in yaml by
adding classes named "external:<name>" or adding a new attribute
"include". It resolves references to other parameters using the sintax
"%{parameter_name}".

This way you can use something like:

        - name: server
          parameters:
           guest_group: "guests"
          classes:
           - generic_server

        - name: linux
          parameters:
           connect_allowed_groups: [ "group1", "group2" ]
          classes:
           - external:server

        - name: node1.mydomain.com
          parameters:
           connect_allowed_groups: [ "%{connect_allowed_groups}", "group3"]
          classes:
           - dbserver
           - external:linux
        
        - name: node2.mydomain.com
          parameters:
           connect_allowed_groups:  ["group1","group3", "%{guest_group}"]
          include:
           - linux
          classes:
           - webserver

And this is exactly what I was needing.

$ ./simple-node-classifier.py node2.mydomain.com
---
classes: [webserver, generic_server]
include: [linux]
name: node2.mydomain.com
parameters:
  connect_allowed_groups: [group1, group3, guests]
  guest_group: guests

$ ./simple-node-classifier.py node1.mydomain.com
---
classes: [generic_server, dbserver]
include: [linux]
name: node1.mydomain.com
parameters:
  connect_allowed_groups: [group1, group2, group3]
  guest_group: guests



Right now it reads from a plain YAML file, but I will add code to
allow delegate the node queries to other external command. This will
allow add inheritance support to other external nodes implementations
easily.

Actually, I will use plain YAML files for a time. I think that is easy
to manage and convenient to have all this configuration in a yaml
file. And I can add it to a CVS repository. Later import it to other
system (like dashboard) would be easy.

In fact, I recomend all new users to start working with plain YAML
files and a script like this one as external node classifier.

--
Atentamente
Héctor Rivas

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

Reply via email to