Blog by Daniel Hauck. Sysadmin, Developer, Blogger.

TAG: provisioning

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!

Automate all the things! But wait a second…

Lazy dude? Listen to the audio version!


Don’t get me wrong, I love automation, I automated a lot of setups and configurations in the past, including:

  • The setup of hundreds of servers
  • software deployments
  • the installation and maintenance of my notebooks, desktops and raspberry pis for home control

I started my career without any of these tools, like ansible, puppet or stuff. We used bash and python scripts to automate routines that appear everyday…

What’s the problem with automation?

Like I told, we dont’ worked with these tools from the beginning, so we did a lot of the things by hand first, without just hitting ‘ansible do-all-the-stuff’. It took longer, sure. But after setting up the services ourselves, we know how every piece of the system works. And the more important thing, we know how to fix the system. I am not saying you shouldn’t automate, automation is great. But I met lot of people who rely on their automation system, to do all the stuff for them. They don’t know how to search for errors or fix them, because they don’t know how to setup the system without configuration management tools.   If you setup a service by hand, then you got the knowledge how to tweak the configuration and you get a better understanding and feeling for the service. You’re not looking at top or ps, ander wonder why three processes are running for dovecot. You know why the service is running, because you configured it, not ansible, not puppet.

So, what should I do?

You should automate all the things! No, nothing is wrong with me, I am not schizophrenic. But before you automate the deployment, the installation or whatever, make sure you did it once per hand. Then you got the knowledge and the feeling, how the service works and why it works like that. If you have to setup a 100 node mail or database cluster, with sharding or other crazy stuff, you’ll be glad if you know it works in the background.

What do you think? Drop me some lines in the comments!

Thanks for reading and be sure to follow me on twitter or similar! Have FUN!

There are no more results.