Symfony, Ansible and your staging server set up in one hour

[Edit]: I’m writting a book about Ansible, click here if want a free draft.
When you start a new project and you create the Ansible provisioning for it, you will do those tasks:

  • Find the right role on Ansible Galaxy and check if there is nothing odd inside.
  • Write the role you need to have a final working provisioning
  • Write the configuration files (group_vars, hosts, var files)
  • Configure your Vagrantfile
  • Test and debug everything until it works fine

All of this requires time and Ansible’s knowledge to perform. So I wrote a very opinionated and simple yeoman like tool to automate it. My choices are:

  • The tool works only on Mac and Linux
  • It is designed to provision only Ubuntu’s servers
  • It targets only the last Ubuntu LTS (currently xenial)

With very one command line, you get what you want:

ansible-symfony-tywin

What is there inside ?

  • A Vagrantfile to launch and configure your local VM
  • An Ansible playbook to provision the local VM and the prod. It includes:
    • Nginx
    • PHP
    • Composer
    • A database role (Mysql, Postgresql or Mongodb)
    • An Ansible playbook which is easy to evolve to satisfy your project specifications
    • The Capifony configuration to deploy the code

The steps are pretty straightforward and explained on the documentation.

If you have any question, feel free to ping me on Twitter and/or create an issue on Github. All feedbacks are very welcome =).

If you want to know more about how to build great Ansible playbook, this article may give you some ideas.


You liked this article? You'd probably be a good match for our ever-growing tech team at Theodo.

Join Us

  • John Gallucci

    I loved the opening comments. That is exactly how I have experienced Ansible for provisioning. I’m still a huge Ansible fan because their roles are self-documenting executable code, even if that means you have to copy someone else’s roles everytime you want to use it. I’m looking forward to seeing how this problem of repurposing and versioning “stable” Ansible roles between environments (rather than have to rewrite them) plays out.

  • Lumbendil

    Why the use of Capifony instead of Capistrano, since you are already using ansible?

  • Maxime Thoonsen

    Hi @Lumbendil:disqus . The idea is to avoid to recode a tool with Ansible. I try to focus only on adding value and since Capifony (which use Capistrano) works fine for use I don’t see the value of creating an Ansible version of Capifony/Capistrano.
    On some projects, where we can’t use Capistrano because the deployment requires more complexity, we did recode a specific deployment tool with Ansible. I hope my answer helps you :)
    Maxime

  • Lumbendil

    Hi,

    Sorry, got things mixed up. I wanted to mention “ansistrano”, which is quite close to Capistrano but without needing ruby :)

  • Maxime Thoonsen

    Cool, I didn’t know this tool. I may switch to it because I’m not a big fan of dealing with all the ruby installation :). Thanks !

  • Careful with “copying” anyone else roles. I Get it, it speeds things up, but would you eat a food that you didn’t know what it was simply because it was faster than looking? I Hope not.

  • Maxime Thoonsen

    Yes you are write you should alway read the role that you copy from somewhere.

  • Jean Saglio

    Great Job!
    It seems that the “documentation” had a small copy-paste issue though :)

  • Maxime Thoonsen

    Hi @jeansaglio:disqus , it’s corrected ;). Thanks!