Blog by Daniel Hauck. Sysadmin, Developer, Blogger.

TAG: mongodb

mongoDB training virtual machine with ansible

Introduction

Today I created a virtual machine for mongoDB. It’s a long time since I worked last time with it. So I wanted a generic machine that I can start, stop or destroy without the need to reinstall it everytime by hand. Sounds like vagrant and ansible 😉

Get our hands dirty

As mentioned, I will use a Vagrant base image of Ubuntu 14.04 and provision it with ansible to install and configure mongoDB. Since I don’t like to use vagrant portmapping for all port that I may be using, I like to use the vagrant plugin ‘vagrant-hostsupdater’.

  1. Install vagrant from here.
    For example on debian or ubuntu:
  2. Install vagrants hostsupdater plugin:
  3. Install git and ansible on your machine
  4. Clone my git repository and change to the directory:
  5. Just run the vagrant machine
  6. That’s it!

After the startup and the provisioning of the vagrant machine finished you either can ssh into the vagrant machine to play with your mongodb instance

or connect directly to mongodb with

That’s the cool thing about the hostsupdater plugin, you can interact with the machine just like a real host, just give it a hostname in the Vagrantfile.

 

So after a couple of minutes you are up and running and can begin your journey with a great noSQL database management system.

Don’t forget to follow me on twitter or subscribe to the newsletter on the left site to recieve the latest posts. Of course you can give me a few stars on github 🙂

 

Have fun!

There are no more results.