Installing MongoDb with Puppet - puppet

I'm a newbie in Puppet, so maybe you'll find my question a bit stupid...
So, I'm looking for puppet recipe that will install and run Mongodb 2.2 on my machine. By googling I found this module http://forge.puppetlabs.com/puppetlabs/mongodb But I didn't understand clear what should I do?
It said I have to install module on puppet node first. What does exactly it means?
Let's say, I have a set of machines those must be configured via puppet.
What do I have to add to puppet recipe to reach this aim?

In case someone might be interest on installing the last version of MongoDB this worked very well for me. At the moment of writing the latest stable version is MongoDB 3.0.3.
First of all update your OS repositories via the puppet apt module (in case you're using a Debian or Ubuntu distribution). Change the data below according to your distribution and version. Check here to get the MongoDB official repositories information: http://docs.mongodb.org/manual/administration/install-on-linux/#recommended
# $::lsbdistcodename should contain what you usually get
# with the `lsb_release -sc` command
$server_lsbdistcodename = downcase($::lsbdistcodename)
apt::source { 'mongodb-org-3.0':
location => 'http://repo.mongodb.org/apt/debian',
release => "${server_lsbdistcodename}/mongodb-org/3.0",
repos => 'main',
key => '7F0CEB10',
key_server => 'keyserver.ubuntu.com',
include_src => false
}
And then set the mongodb::globals class properly to make sure you get MongoDB 3. The MongoDB puppet module I'm using is this one.
class { 'mongodb::globals':
manage_package_repo => false, # disable the 10gen repository
server_package_name => 'mongodb-org',
service_name => 'mongod',
version => '3.0.3',
}->
class { '::mongodb::server': }

Getting mongodb installed with puppet isn't as easy as it seems. It's somewhat difficult to get official Puppet Labs module v0.8.0 to install mongodb 2.6.3. You end up getting an apt error about mongodb-10gen=2.6.3 not being found. There's an issue and a patch already but it hasn't been published yet.
So here's what you need to do:
git clone https://github.com/puppetlabs/puppetlabs-mongodb.git
Then use the following puppet config:
class { '::mongodb::globals':
manage_package_repo => true,
server_package_name => 'mongodb-org',
version => '2.6.3'
}->
class { '::mongodb::server': }
This Worked for me.

If you are running puppet standalone, you will have already installed the puppet gem and have the puppet executable. To intall the module, you run puppet module install puppetlabs/mongodb. After the module installation, you can simply include the mongodb module in your node definition
node 'myhost' {
include mongodb
}
If you want to run a number of nodes that need access to the module, you'll have to setup a puppetmaster and install the node. See [Basic Agent/Master setup][1] for more info. Make sure that pluginsync=true is enabled in puppet.conf so the module can make it's way to the remote agents.
The puppetmaster will then need a file, normally site.pp defined with the nodes it should configure. Finally, include the mongodb module on each node you want to run mongodb and you should be up and running.

Related

Domino10 appDevPack: "Error: Cannot find module '#domino/domino-db'"

Just installed the latest Domino 10.0.1 Server on my linux machine and also installed and configured the latest proton package. As far as I can tell it's all running fine.
Next I plan to try my first Node-RED flow using the new Domino10 nodes. So I installed the 'node-red-contrib-dominodb' palette.
Finally tried my first very simple flow trying to query node-demo.nsf as it's described here. From what I read there I assumed that it's sufficient to install the palette, but that obviously is not the case:
as soon as I hit 'Deploy' I receive this error:
Error: Cannot find module '#domino/domino-db'
So I thought that I maybe still have to do a global install in node.js using
npm install -g <package-path>/domino-domino-db-1.1.0.tgz
This indeed created a local #domino/domino-db module inside my node.js npm\node_modules folder. But obviously my node-red environment doesn't know about it.
Question is: how do I register / install that npm package for my local node-red environment?
IBM's instructions (https://flows.nodered.org/node/node-red-contrib-dominodb#Installation)
Say to go view this guide(https://github.com/stefanopog/node-red-contrib-dominodb/blob/master/docs/Using%20the%20new%20Domino%20V10%20NodeRED%20nodes%202.pdf) for installing the domino-db module.
The link is broken, here's an old copy: https://github.com/stefanopog/node-red-contrib-dominodb/blob/a723ef88498c5bfa243abd956a7cc697f0a42610/docs/Using%20the%20new%20Domino%20V10%20NodeRED%20nodes%202.pdf
I believe the section you want is called "Import the tarball". The steps before that require you to unpack and then re-pack the module... which is unnecessary. Just use the tgz that was in the AppDev Pack to begin with.

Artifactory Unable to find module with librarian-puppet

I'm trying to use the librarian-puppet to fetch forge modules from an Artifactory repository.
In my Puppetfile I have something like:
forge "https://<artifactory_host>/artifactory/api/puppet/<repo_key>" #From artifactory docs
# PuppetLabs Modules
mod 'puppetlabs/stdlib', '4.24.0'
The command that I'm using is /usr/local/bin/pdk bundle -- exec librarian-puppet install --no-use-v1-api --verbose
The error that I get is:
[Librarian] Resolving puppetlabs-stdlib (= 4.24.0) <https://<artifactory_host>/artifactory/api/puppet/<repo_key>>
[Librarian] Checking manifests Unable to find module 'puppetlabs-stdlib' on https://<artifactory_host>/artifactory/api/puppet/<repo_key>
/tmp/tmp.BXyhBoNRiR/.pdk/cache/ruby/2.1.0/gems/librarian-puppet-3.0.0/lib/librarian/puppet/source/forge/repo_v3.rb:44:in `rescue in get_module'
/tmp/tmp.BXyhBoNRiR/.pdk/cache/ruby/2.1.0/gems/librarian-puppet-3.0.0/lib/librarian/puppet/source/forge/repo_v3.rb:41:in `get_module'
Versions:
puppet 3.8.7
pdk 1.5.0
ruby 2.1.9
According to the documentation at https://www.jfrog.com/confluence/display/RTF/Puppet+Repositories#PuppetRepositories-Usinglibrarian-puppet, it seems I'm trying to get the modules correctly using the librarian-puppet, but something most be missing.
Thanks for any help.
I think Artifacotry does not support Puppet 3.8.7 its documented in Wiki.
Puppet version support
Puppet does not support a context path up to version 4.9.1, we recommend using Artifactory with Puppet version 4.9.2 and above. Please see below if you are using Puppet 4.9.1 and below.
The official Artifactory documentation (not a wiki) recommends using Puppet 4.9.2 or later with Artifactory:
Puppet version support
Puppet does not support a context path up to version 4.9.1, we
recommend using Artifactory with Puppet version 4.9.2 and above.
Please see below if you are using Puppet 4.9.1 and below.
(Emphasis in the original.)
As that comment indicates, however, the docs do also suggest a workaround for use with earlier Puppet:
If you need to use Puppet 4.9.1 and below you can use a workaround
which uses NGINX or Apache to rewrite all requests from /v3/* to
/artifactory/api/puppet/<repo-name>/v3/*.
The docs go on to present some example configurations, which I will not repeat here.

Puppet : Warning: Only one file can be applied per run. Skipping

I'm installing an application called "Bag Of Holding" using the puppet script provided on github. I installed successfully then needed to make a change to the site.pp and init.pp file but when I tried to recompile using (puppet apply ), I got the warning message
Warning: Only one file can be applied per run. Skipping /etc/puppet/manifests/site.pp
And no other activity on the screen. I was unable to access my application after that. After a day of troubleshooting I gave up and started from scratch - re-install my CentOS, puppet, and all the folder directories were in place, but as soon I run "puppet apply", I got the same Warning as previously and I have since not been able to access the application.
How could the compilation fail for a newly installed operating system with application being installed freshly? Is it not possible to run puppet site.pp file more than once? Is there anything hard coded to the server after the first run and can no longer accept additional compilation? Both site.pp and init.pp file are on the github I posted above. I'm running masterless puppet configuration set up.
site.pp code:
# adding boh module to the node
node 'boh.domain' {
class { 'boh':
python_version => 3,
environment => 'dev',
language => 'pt-br',
debug => 'True',
create_superuser => 'true',
pkg_checksum => '86b0164f7fd6c5e4aa43c8f056f08cea',
}
}
Question no longer relevant. I found the fix by ensuring appropriate syntax was being used...puppet apply -
-- modulepath=
Thanks

Vagrant + chef-solo + berkshelf: node.js last version cookbook

Basically, i need a working machine with node.js & npm installed.
I've configured a vagrant + berkshelf + chef enviroment, but i can't find a lastest version (>= 4.0.0) nodejs cookbook as source for my berksfile.
I've tried with this:
https://supermarket.chef.io/cookbooks/nodejs
from chef supermarket but install a old version of node + npm.
I am experiencing for the first time vagrant and chef so i can't understand how find it.
Can someone help me?
In your role or node settings you can specify default attributes for any cookbook you use. Cookbook nodejs allows you to set NodeJS version with the attribute version (check its attributes/default.rb file). But this attribute is taken into account only when NodeJS is installed from precompiled binaries or sources. So you need to specify install_method as well (default is package, i.e. installation via system package manager).
One more thing: you need to manually specify binary package checksum, which you can find in every release folder here: https://nodejs.org/download/release/
So, to install the latest version from official binaries use the following settings in role or node:
"nodejs": {
"install_method": "binary",
"binary": {
"checksum": "75b029b30d4a4147d67cf75bf6e034291fb5919c6935ec23f8365cee2d463f12"
},
"version": "5.3.0"
}

How to uninstall package using puppet

I have installed mysql in a client node using Puppet. Now I want to uninstall it in the client node. I tried the following configuration in site.pp:
package { '::mysql::server':
ensure => 'purged'
}
This did not work. Can someone show me how to uninstall mysql (or any package for that matter)?
That syntax is wrong. ::mysql::server is either referencing a puppet class or defined type. You only need to specify the package name to the package type.
package { 'mysql_package_name':
ensure => absent
}
Replacing mysql_package_name with the name of the package for the distro you are using.

Resources