Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Ansible a replacement for a CI tool like Hudson/Jenkins?

Recently, in our company, we decided to use Ansible for deployment and continuous integration. But when I started using Ansible I didn't find modules for building Java projects with Maven, or modules for running JUnit tests, or JMeter tests.

So, I'm in a doubtful state: it may be I'm using Ansible in a wrong way.

When I looked at Jenkins, it can do things like build, run tests, deploy. The missing thing in Hudson is creating/deleting an instance in cloud environments like AWS.

So, in general, for what purposes do we need to use Ansible/Jenkins? For CI do I need to use a combination of Ansible and Jenkins?

Please throw some light on correct usage of Ansible.

like image 580
Ganesh P Avatar asked Sep 15 '14 07:09

Ganesh P


People also ask

Can Ansible replace Jenkins?

Although Ansible Tower can be considered a replacement for Jenkins, it does not yet have the latter's huge plugin support. Conversely, Jenkins will not be able to handle complex architectures as easily as Ansible Tower.

Is Ansible same as Jenkins?

Ansible is a powerful tool for automation to the provision of the target environment and to then deploy the application. Jenkins is a popular tool for IT automation and used for Continuous Integration/Continuous Delivery (CI/CD) to provision the target environment.

Is Ansible a CI tool?

Ansible is a powerful tool for IT automation and can be used in a CI/CD process to provision the target environment and to then deploy the application on it.

Why Jenkins is better than Ansible?

Ansible will likely be a good fit for teams that need IT automation software capable of handling complex cloud environments or need to streamline configuration, provisioning and similar tasks. Jenkins, by contrast, is an excellent CI/CD tool that can be extended significantly with the right plugins.


2 Answers

First, Jenkins and Hudson are basically the same project. I'll refer to it as Jenkins below. See How to choose between Hudson and Jenkins?, Hudson vs Jenkins in 2012, and What is the most notable difference between Jenkins and Hudson from an user perpective? for more.

Second, Ansible isn't meant to be a continuous integration engine. It (generally) doesn't poll git repos and run builds that fail in a sane way.

When can I simply use Jenkins?

If your machine environment and deployment process is very straightforward (such as Heroku or iron that is configured outside of your team), Jenkins may be enough. You can write a custom script that does a deploy as the final build step (or a chained step).

When can I simply use Ansible?

If you only need to "deploy" without needing to build/test, Ansible might be enough. For instance, you can run a deploy from the commandline or using Ansible Tower. This is great for small projects, static sites, etc.

How do they work together?

A good combination is to use Jenkins to build, test, and save artifacts. Add a step to call Ansible or Ansible Tower to handle the actual deployment process. That allows Ansible to handle machine configuration and lets Jenkins handle the CI process.

What are the alternatives to Jenkins?

I strongly recommend Thoughtworks Go (not to be confused with Go the language) instead of Jenkins. Others include CruiseControl, TravisCI, and Integrity.

like image 176
tedder42 Avatar answered Oct 17 '22 02:10

tedder42


Ansible is just a "glorified SSH loop". CI is not only the software running, but the whole process of how success and failure is handled, who gets notification, and how the change is merged into the target version control.

If we only focus on the software, CI is a reactive scheduler triggered by code changes, and triggering typical build-validate-release-deploy sequence of "steps".

So in respect of software, Ansible without additional "sugaring" is just a toolkit to run things, which can be those very steps, but it is not CI. The Ansible (without tower) totally lacks this reactive nature.

If you want to marry Ansible with CI, you can.

Ansible tower is a very Ansible oriented scheduler, but if you need CI software, I think you not necessarily need it. Any CI app capable of running shell script would be capable to launch Ansible playbooks.

Yet unlike Ansible tower - CI tools know to display test reports of all test frameworks, trigger notifications, etc.

Ansible tower can make sense in a complex environment with lots of groups touching Ansible code... The truth is I haven't seen a single real reason to pay for it. But if a manager liked the web interface nothing can stand "but others use it" logic.

I suspect the concept of Ansible tower was in response to puppet enterprise.

:)

like image 21
mvk_il Avatar answered Oct 17 '22 00:10

mvk_il