Puppet Blog

Back to Index

Couchdb facts terminus for Puppet

Posted on
By
Dan Bode
in
Blog, Tips
Responses
3 Comments »

Starting in Puppet 2.6, its possible to store all facts in a couchdb database.

Installation for CentOS 5.x

  1. ensure that epel, base and updates yum repos are enabled:
  2. install couchdb

    yum install couchdb
  3. ensure that rubygem is installed
    yum install rubygems
  4. install gcc

    yum install gcc
  5. Install couchrest 1.0.0 (note: 1.0.1 does not work with ruby 1.8.5)

     gem install couchrest -v1.0.0
  6. ensure that a 2.6.x version of puppet is installed (I recommend 2.6.3)

Configure:

  • configure the couchdb facts terminus in puppet.conf

    #puppet.conf
    [master]
      couchdb_url=http://127.0.0.1:5984/puppet
      facts_terminus=couch
  • Configure couch to bind to 0.0.0.0
    [httpd]
    port = 5984
    bind_address = 0.0.0.0
  • start couchdb – I recommend starting it in the forground so that you can monitor the http requests.

    couchdb
  • start up puppetmasterd in the foreground

    puppet master --no-daemonize --verbose

Create facts:

  • run a puppet agent

    puppet agent -t
  • run a few more to create more data to view in couch
    puppet agent -t --certname foo
    puppet agent -t --certname bar
    puppet agent -t --certname baz

Profit!

Now facts from all of our clients will be stored as documents in couchdb.

Advantages:

  1. Facts can be aggregated to a separate service to be queried.
  2. We can now access a clients fact information using Couch's RESTful interface.

To view the facts documents in couchdb, access the document managment interface of couchdb;

http://puppet-test:5984/_utils/

To acess facts with curl:

curl --get http://localhost:5984/puppet/foo
curl --get http://localhost:5984/puppet/bar
curl --get http://localhost:5984/puppet/baz

3 Comments

James Turnbull

Chris – not sure what you mean? Can you clarify? Thanks.

Leave a Response