Brief Comparison of Ansible and Chef

Cagri Yonca
3 min readAug 13, 2021

What is Configuration Management?

Configuration management came about to address the fundamental challenges involved in doing group work. Managing change when you are a lone administrator with a handful of servers to manage is relatively straightforward.

Why we need a Configuration Management Tool to Automate IT?

There are four main reasons to use Management Tools:

  • Consistency. You may want to be sure about if your servers are set up in a consistent manner.
  • Efficient change management. When an organization want to develop processes for managing changes.
  • Simplicity in rebuild. If you need to rebuild servers manually, it will be very challenging with a management tool.
  • Visibility. Configuration management tools include auditing and reporting capabilities. For one administrator, this issue will not be a big problem but if you are trying to understand what is going on for 10 system administrators you will need a configuration tool.

What is Chef?

Chef is an automation platform that configures and manages your infrastructure. Whether you are operating in the cloud, on-premises, or in a hybrid environment, Chef automates how infrastructure is configured, deployed, and managed across your network.

  • Your infrastructure is versionable.
  • Your infrastructure is repeatable.
  • Your infrastructure is testable.

What is Ansible?

Ansible is an open source tool which you can automate cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs. It’s open source but has also paid services like Tower to visualize data on dashboard.

Ansible vs Chef

There are a lot of differences between these two tools. We will look at to differences now.

Ansible calls its configuration files “playbooks”, while Chef calls them “cookbooks”.

Ansible’s playbooks are not complex to create but you have Python’s limitations to make complex tasks. Chef’s cookbooks can be thought like bash scripts, you can do more complex jobs.

Ansible uses a master running on the server machine, it doesn’t require any agent to connect from client machine. It uses SSH connection to do operations. Chef operates with a master-client architecture. The server part runs on the master machine, while the client portion runs as an agent on client machine.

This makes Ansible faster than Chef to run commands on master.

Ansible’s source of truth comes from its deployed playbooks, which are perfect as source control systems, while Chef relies on its own server as the source of truth, and those servers require uploaded cookbooks which means making sure the latter are consistent and identical.

Ansible is just more easier and useful.

Ansible uses YAML to manage configurations, while Chef is using Ruby DSL configuration scripts for server.

No comment, YAML vs Ruby DSL.. Choose which one is easier for you.

Chef’s Ruby DSL is awesome for teams who works Ruby for their actual works.

If you have a complex cloud deployment across platforms such as Amazon, Google Cloud, Azure and OpenStack with regular schedules for server updates, Chef is great option.

Conclusion

If you need to do complex tasks and know Ruby, use Chef, otherwise I’d choose Ansible which is more easier to use and develop.

Please leave comments, I’d be pleased to make these articles better.

--

--