Created
June 30, 2011 01:04
-
-
Save boundvariable/1055418 to your computer and use it in GitHub Desktop.
Puppet node definitions via CouchDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_id": "a58af3e3e43733657152f59865021e0f", | |
"_rev": "28-c7d4a44d4c176886cf742ebec4876550", | |
"classes": [ | |
"balancer" | |
], | |
"host": "example.com", | |
"directors": [ | |
{ | |
"name": "temp", | |
"backends": [ | |
{ | |
"name": "example", | |
"ip": "" | |
} | |
] | |
} | |
], | |
"ip": "192.168.0.99", | |
"stomp_server": "192.168.0.33", | |
"user": "system" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'couchrest' | |
require 'yaml' | |
@db = CouchRest.database!("user:[email protected]/nodes") | |
@db.view("list/all")['rows'].reject { | node | node['key']['host'] != ARGV[0] }.each do | node | | |
@classes = [] + node['key']['classes'].to_a | |
@node_definition = { | |
"classes" => @classes, | |
"environment" => "production", | |
"parameters" => node['key'] | |
} | |
puts @node_definition.to_yaml | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class balancer { | |
include varnish | |
include mcollective | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment