I'm very new to Ansible and the whole team of DevOps. Previously I had experience with Envoyer provided by Laravel. Now I wanted to use Ansible or similar service for handling auto-deploy task. What I mean is that I want to be able to deploy my apps only with single command git push, and depending on the branch I pushed to the app should be deployed to different servers.

After what I've read about Ansible it looks like I will need at least run additional command like executing playbook, plus any of devs working on the same project will need to install ansible on local machine.

So Envoyer or CodeShip uses git hooks for that, after push is done CodeShip makes git pull and runs necessary commands. Not sure how Ansible may help here.

Plus, what's important, as I realize when I deploy frontend application which is build by npm run build, I need to deploy only the result of this command, like a folder with concatenated & minified etc files, holding the result of build. The building process itself probably should be done on another machine. So I guess Ansible won't help me here?

  • maybe take a look at what the git hooks could do for you. Commented Apr 30, 2017 at 12:38

2 Answers 2


Continuous integration tools primary use case is building and testing software packages. Configuration management tools like Ansible primary use case is installing and configuring hosts.

However, because either can run arbitrary commands, you can have them call each other. Your choice of CI could watch a particular repo, build the software, and stage it somewhere. The CI also could watch a different repo from which it regularly calls ansible-playbook to deploy and configure. Commit a change to the software repo and the fixed package is built, commit a new test VM in the inventory file and it will be deployed with a standard config.

Developers don't have to have ansible installed. They could test their playbooks from a UNIX server, just needs Python. Or use the Tower product's web interface.


For personal or very small use cases, git hooks and ansible might work, but you really should be testing your code (continuous integration) before you deploy it (continuous deployment). If you want a CI and CD pipeline consistent with industry best practices, a tool like GitLab w/GitLab CI is an ideal solution (https://about.gitlab.com/features/gitlab-ci-cd/). With GitLab CI, you can specify your testing and deployment logic inside a .gitlab-ci.yml file which can conditionally run based off git branch. GitLab is open-source and free for self-hosting.

Note: I do not work for GitLab, I am just a huge fan of the tool!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .