[Infographic] Ansible vs Chef

Posted by UpGuard

Ansible vs. Chef

This is a tale of a newcomer vs a relative oldie in the Configuration Management (CM) arena. Both are tools to help the sysadmin or devops professional to better manage large numbers of servers. They excel at stuff like repetitive task automation, simultaneous deployment of apps and packages to a group of servers, or configuration and provisioning of new servers from scratch.

What They Are, How They Work

Chef was originally released in 2009 - in the world of CM tools, that’s an eternity ago. It is supported by parent sponsor Opscode, and is frequently compared and contrasted to that other old-timer CM tool Puppet. Like Puppet, Chef is also written in Ruby, and its CLI also uses a Ruby-based DSL. Chef utilizes a master-agent model, and in addition to a master server, a Chef installation also requires a workstation to control the master. The agents can be installed from the workstation using the ‘knife’ tool that uses SSH for deployment, easing the installation burden. From there managed nodes authenticate with the master through certificates. Chef doesn't yet have a well-formed push feature, though beta code is available to do this. But in the meantime the implication is that agents must be configured to check in with the master periodically and instantaneous master-to-agent rollout of changes isn't really possible. Continuing with the kitchen metaphor (see ‘knife’ above), Chef configs are packaged into JSON files called ‘recipes’. Also, the software can run in either a client-server or in a standalone mode called ‘Chef-solo’. 

Ansible is quite different from Chef. It is similar to another upstart, Salt, than to the old boys Chef and Puppet. It was developed and first released in early 2012 by the parent company AnsibleWorks, and is starting to gain a dedicated following despite its youth and untested-ness. It is written in Python and only requires the Python libraries to be present on the servers to be configured, which anyway is the default on almost all Linux distros today. Ansible’s USP’s are its light weight, relative ease of use and speed of deployment compared to other CM tools. For example you don’t need to learn Ruby - Ansible packages all commands into YAML modules called playbooks - as long as your preferred language can output JSON modules, you’re good to go. Ansible also does away with the need for agents; all master-agent communication is handled either via standard SSH commands, or the Paramiko module which provides a Python interface to SSH2. An added bonus is the SSH’s excellent inbuilt security.

Which is better, Salt or Chef?

Support, Performance, Ease of Use

<!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In -->
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="437px" height="103px" viewBox="0 0 437 103" style="enable-background:new 0 0 437 103;"
xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<defs>
</defs>
<g>
<g>
<path class="st0" d="M120.7,63.7c0,8,4.2,12.1,12.7,12.1c8.5,0,12.7-4,12.7-12.1V21.5h10.1v42c0,7.3-1.9,12.6-5.8,16
c-3.8,3.4-9.5,5-17.1,5c-7.6,0-13.3-1.7-17.1-5c-3.8-3.4-5.7-8.7-5.7-16v-42h10.1V63.7z"/>
<path class="st0" d="M168.5,103V38.2h9.8V41c4.2-2.5,8.1-3.8,11.7-3.8c6,0,10.4,1.8,13.1,5.5c2.8,3.7,4.2,9.8,4.2,18.4
c0,8.6-1.6,14.7-4.8,18.2c-3.2,3.5-8.4,5.3-15.5,5.3c-2.5,0-5.3-0.3-8.6-0.8V103H168.5z M188.2,46c-2.8,0-5.7,0.6-8.5,1.9
l-1.4,0.6v26.7c2.4,0.5,5.1,0.7,8,0.7c4.1,0,6.9-1.2,8.5-3.5c1.6-2.4,2.4-6.4,2.4-12.1C197.2,50.8,194.2,46,188.2,46z"/>
<path class="st0" d="M243.6,59.8v-8.9h17.7v31.5c-1.6,0.4-4.9,0.9-9.9,1.4c-5,0.5-8.6,0.7-10.8,0.7c-9.4,0-15.9-2.6-19.5-7.8
c-3.6-5.2-5.3-13.3-5.3-24.4c0-11.1,1.8-19.2,5.5-24.2c3.7-5.1,10-7.6,19-7.6c5.3,0,11.3,0.6,17.9,1.8l3.2,0.6l-0.4,8
c-7.3-1-13.9-1.4-19.7-1.4s-9.8,1.6-11.9,4.9c-2.1,3.3-3.2,9.3-3.2,18.1c0,8.8,1,14.9,3,18.3c2,3.4,6.1,5,12.3,5
c4.4,0,7.7-0.3,9.9-0.8V59.8H243.6z"/>
<path class="st0" d="M300.1,38.2h9.8v45.3h-9.8v-2.8c-4.4,2.5-8.5,3.8-12.2,3.8c-6.2,0-10.4-1.7-12.5-5c-2.1-3.4-3.2-9.2-3.2-17.6
V38.2h9.9V62c0,5.4,0.5,9.1,1.4,11c0.9,1.9,3,2.8,6.3,2.8c3.3,0,6.3-0.6,9-1.8l1.4-0.5V38.2z"/>
<path class="st0" d="M355.4,52.2v20.7c0.1,1.3,0.4,2.3,1,2.9c0.6,0.6,1.6,1,2.9,1.2l-0.3,7.5c-5.2,0-9.2-1.1-12.1-3.4
c-4.8,2.2-9.7,3.4-14.6,3.4c-9,0-13.5-4.8-13.5-14.4c0-4.6,1.2-7.9,3.7-10c2.4-2.1,6.2-3.3,11.3-3.7l11.7-1v-3.3
c0-2.4-0.5-4.1-1.6-5.1c-1.1-1-2.6-1.5-4.7-1.5c-3.9,0-8.7,0.2-14.5,0.7l-2.9,0.2l-0.4-7c6.6-1.6,12.6-2.4,18.2-2.4
c5.5,0,9.5,1.2,12,3.6C354.2,43.2,355.4,47,355.4,52.2z M335.1,63.4c-4.2,0.4-6.3,2.6-6.3,6.8s1.8,6.3,5.5,6.3
c3,0,6.2-0.5,9.6-1.4l1.6-0.5V62.4L335.1,63.4z"/>
<path class="st0" d="M367.8,83.5V38.2h9.8v5.4c5.1-3.3,10.3-5.5,15.4-6.4v9.9c-5.2,1-9.6,2.4-13.3,4l-2,0.8v31.6H367.8z"/>
<path class="st0" d="M437,19.4v64.1h-9.8v-2.4c-4.4,2.2-8.5,3.4-12.1,3.4c-5.9,0-10.3-1.8-13-5.3c-2.7-3.6-4.1-9.5-4.1-17.9
c0-8.4,1.5-14.5,4.6-18.3c3-3.8,7.8-5.7,14.3-5.7c2.2,0,5.6,0.4,10.3,1.2v-19H437z M425.6,74.1l1.5-0.6V46.6
c-3.6-0.6-7-0.9-10.1-0.9c-6.1,0-9.2,5.1-9.2,15.2c0,5.6,0.7,9.4,2.1,11.6c1.4,2.1,3.7,3.2,6.8,3.2S422.8,75.2,425.6,74.1z"/>
</g>
<path class="st0" d="M83.4,51.2c-2.8,6.1-6,11.7-8.9,16.5c-3,5.2-5.9,9.9-9.6,15.1c-1.4,2-3,4.2-4.8,6.5
c-4.6,5.7-11.6,10.9-19.3,8.8c-7.8-2.2-12-9.3-16.4-15.5c-6.8-9.4-13.2-19.7-18.4-31.1c-5-11-9.6-24.9-2.5-36.1
c1.9-3,4.4-5.4,7.2-7.4c1.9-1.3,4-2.3,6.1-3.2c14.6-6,32.8-5.8,47.9-2.3c4.7,1.1,9.1,2.7,13,5.1c2.6,1.6,4.9,3.7,6.8,6.2
c2.9,3.8,4.3,7.8,4.7,11.9C90.3,34.2,87.1,43.2,83.4,51.2L83.4,51.2z"/>
</g>
</svg>
Chef is an older product, so its documentation is better than Ansible’s. That said, there are complaints by many new to Chef that it is quite confusing to learn compared to the blissfully simple Ansible. Chef offers support for Linux, *nix, and Windows. The browser-based GUI is quite good (again, no surprise considering it’s been around for a few years), although it’s not as complete as Puppet’s, lacking features like reporting and advanced config options. All in all, Chef’s relative maturity means it may appeal to corporations, who place a premium on stability, more than individuals.

IT guys are famous for avoiding documenting anything, so it’s no surprise that Ansible’s documentation is still a weak point. This, however, is somewhat mitigated by how easy it is to learn. Ansible is currently only available for Linux and Unix, and its GUI is terrible compared to Chef’s – it’s not even synced to the CLI, so you may occasionally find that the GUI and CLI give different results of a query. Ansible’s agent-less push-mode using the ZeroMq implementation at the transport layer means quick deployment and very low performance overhead; the caveat is that it’s just not as flexible and powerful as using agents.

Which is better, Puppet or Chef?

Conclusion

First off, any admin or devops will be mighty glad to have such tools in their corner; just a few years ago there was much less choice in this field. Choosing either of them is a win, and your life will be richer and easier for it.

That said, if you must choose between them, consider your own needs carefully first and weigh them against what each solution offers. You can use the infographic below to compare Chef and Ansible.

Ansible vs. Chef

  Get Started With UpGuard

References

 

Topics: Infographic, chef, configuration management, ansible

UpGuard customers