Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems' # not necessary for Ruby 1.9+
- require 'mongo'
- include Mongo
- #TODO: put this into configuration file
- mongodb_server = "127.0.0.1"
- mongodb_port = 27017
- mongo_client = MongoClient.new(mongodb_server, mongodb_port)
- puppetdb = mongo_client.db("puppet")
- #auth = db.authenticate(my_user_name, my_password)
- mco_nodes = puppetdb.collection("nodes")
- puts mco_nodes.find().count()
- #puts mco_nodes.find("fqdn" => /ser/).to_a
- puts "Apache Servers: " << mco_nodes.find("facts.apache_server" => "true").count().to_s
- puts "MySQL Servers: " << mco_nodes.find("facts.mysql_server" => "true").count().to_s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement