donderdag 3 juli 2014

puppet-mongodb and the story of the missing provider

So I found myself setting up this mongoDB cluster with puppet. It turns out puppetlabs has its own mongodb module, so I started using that. The documentation told me to set up the class from the nodes definition like such:

  class {'::mongodb::globals':
    manage_package_repo => true,
  }->
    class {'::mongodb::server':
      auth    => false,
      ensure  => present,
      rest    => true,
      dbpath  => "/e/data/mongodb",
      logpath => "/e/logs/mongodb/mongodb.log",
      bind_ip => ["127.0.0.1" , "x.x.x.x"],
    }->
    mongodb_database { 'feed':
      ensure   => present,
      tries    => 10,
      require  => Class['mongodb::server'],
      }

and that installed mongodb-org-server and started it. great. But every puppet run it would give me this message:
Error: Could not find a suitable provider for mongodb_database


And no matter what I tried, I could not get this fixed. Googling and reading puppet docs did not seem to help. There were no incidents or forks of the puppetlabs mongodb module that seemed to address this. In the end I asked the puppet irc channel for help, and it quickly turned out that in order for the module to create a database, the module needs the mongo command. And that command is provided (by installing the mongodb-org-tools rpm) by the mongodb::client class. Which I did not have defined, because the documentation did not specify I would. Adding that, the nodes definition became:

  class {'::mongodb::globals':
    manage_package_repo => true,
  }->
    class {'::mongodb::server':
      auth    => false,
      ensure  => present,
      rest    => true,
      dbpath  => "/e/data/mongodb",
      logpath => "/e/logs/mongodb/mongodb.log",
      bind_ip => ["127.0.0.1" , "x.x.x.x"],
    }->
    class {'mongodb::client':}->
    mongodb_database { 'feed':
      ensure   => present,
      tries    => 10,
      require  => Class['mongodb::server'],
      }

And then things started working.

Geen opmerkingen:

Een reactie posten