Blog by Daniel Hauck. Sysadmin, Developer, Blogger.

TAG: ansible

PHP / Symfony Development Environment with Vagrant and Ansible – BONUS: MySQL

As I have received multiple requests now, I decided to make a little bonus for you 😉

It seems like a lot of you prefering mysql over postgresql. I don’t understand why, but that’s another topic 😉

You can do it!

Actually it ain’t that hard. But let’s go through it, step by step.

First, as usual, create your role:

We will reuse our apps config from the postgres database here, so nothing to change in case of the group_vars/all file.

Now it’s time to install the mysql server itself, therefore create a main.yml as usual:

As with postgres, to create databases and users, we need to install the python mysql binding, let’s to it.

Last but not least we will finally create our users and their databases:

Test it!

Get rid of the postgres role in provisioning/playbook.yml and replace it with

Now run your provisiong again, and you are ready to use mysql.

Ain’t that easy? See you next time!

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.