# Nixos vs Ansible

**URL:** https://discourse.nixos.org/t/nixos-vs-ansible/16757
**Category:** Uncategorized
**Created:** [December 23, 2021, 3:14pm UTC](https://discourse.nixos.org/t/nixos-vs-ansible/16757 "2021-12-23T15:14:18Z")
**Posts on this page:** 1
**Showing post:** 17

<div class="post-metadata">

### Author: ![nh2](https://discourse.nixos.org/user_avatar/discourse.nixos.org/nh2/32/631_2.png) [@nh2](https://discourse.nixos.org/u/nh2)
#### Post date: [December 29, 2021, 3:53pm UTC](https://discourse.nixos.org/t/nixos-vs-ansible/16757/17 "2021-12-29T15:53:50Z")

</div>

I have used Ansible for the devops of my company, and can confirm what Ryan says:

> [@ryantm](#):
>
> Ansible has a Convergent model of system configuration whereas NixOS tries to achieve and comes much closer to achieving a Congruent model

Here’s a [simpler article](https://blog.flyingcircus.io/2016/05/06/thoughts-on-systems-management-methods/) about the same **Divergent, Convergent, Congruent** system management concepts. Concretely:

In Ansible, if you declare yourself an Nginx webserver into its YAML files, and deploy, Nginx is running.  
If you delete Nginx from the YAML file, and deploy, Nginx **is still running**.

Thus, Ansible does not actually provide proper declarative system management: There is no guarantee that what you write in your YAML files isn’t actually what’s running on your servers.

Further, even our moderately-sized Ansible playbooks took \> 10 minutes to run, because Ansible is just an imperative command runner without a real understanding of what’s happening on the other system, so there is no proper incrementality. To alleviate that, you can try to use [conditionals](https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html) but they are almost impossible to get right, and so you often end up some change that you want deployed being skipped accidentally. We wanted something that will take only a few seconds when, say, changing `nginx.conf`, and restarting only those things that actually depend on `nginx.conf`.

In combination, those 2 issues were unacceptable for my company. I thought that there must be a better way, and found `nixops`, and thus NixOS.

Thus we switched all our servers from Ansible to NixOS + nixops 5 years ago, and are very happy with it. Deploys are now declarative, and small changes apply within seconds.

---

_[View the full topic](https://discourse.nixos.org/t/nixos-vs-ansible/16757)._
