{"id":5213,"date":"2017-01-03T14:49:23","date_gmt":"2017-01-03T14:49:23","guid":{"rendered":"http:\/\/blog.cloudthat.com\/?p=5213"},"modified":"2024-06-25T11:12:18","modified_gmt":"2024-06-25T11:12:18","slug":"configuration-management-tools-ansible-vs-puppet","status":"publish","type":"blog","link":"https:\/\/www.cloudthat.com\/resources\/blog\/configuration-management-tools-ansible-vs-puppet","title":{"rendered":"Configuration Management Tools : Ansible vs Puppet"},"content":{"rendered":"<p>There is always a debate spinning around which configuration management tool to use Ansible or Puppet?<\/p>\n<p>According to me, there is no clear winner, it all depends on your team\u2019s requirements and choice. In this blog, I will discuss both the configuration management tools without being biased.<\/p>\n<p>Let&#8217;s start with:<\/p>\n<p>Server Nodes<\/p>\n<ul>\n<li>Puppet infrastructure generally contains\u00a01 (or more) \u201cpuppetmaster\u201d servers, along with special agent packages installed on each client node<\/li>\n<li>Ansible has neither a special master server, nor special agent executables to install. The executor can be any machine with a list (inventory) of the nodes to contact, the Ansible playbooks and proper SSH keys\/credentials to connect to the nodes<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Push vs Pull<\/p>\n<ul>\n<li>Puppet nodes have special client software, which periodically check puppet master server to \u201cpull\u201d resource definitions<\/li>\n<li>Ansible follows a \u201cpush\u201d workflow. The machine where Ansible runs from SSH\u2019s into the client machines and uses SSH to copy files, remotely install packages, etc. The client machine requires no special setup outside of a working installation of Python 2.5+<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Resources &amp; Ordering<\/p>\n<ul>\n<li>Puppet: Resources defined in a Puppet manifest are not applied in order of their appearance (ex: top-&gt;bottom). Instead, \u00a0resources are applied randomly,\u00a0unless explicit resource ordering is used. Ex: \u201cbefore\u201d, \u201drequire\u201d, or chaining arrows<\/li>\n<li>In Ansible, the playbooks are applied top-to-bottom, as they appear in the file<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Resource Dependency Graphs<\/p>\n<ul>\n<li>Puppet internally creates a directed graph of all of the resources to be defined in a system along with the order they should be applied in. This is a robust way of representing the resources to be applied. Puppet can even generate a graph file so that one can visualize everything that Puppet manages. On the down side, \u00a0building this graph is susceptible to \u201cduplicate resource definition\u201d errors (ex: multiple definitions of a given package, user, file, etc)<\/li>\n<li>Ansible is basically a thin-wrapper for executing commands over SSH, there is no resource dependency graph built internally. One could view this as a weakness as compared with Puppet\u2019s design, but it also means that these \u201cduplicate resource\u201d errors are completely avoided. The simpler design lends itself to new users understanding the flow of the playbook more easily.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Batteries Included vs DIY<\/p>\n<ul>\n<li>Puppet provides a series of primitives\u00a0(File, User, Package, Service, etc) which can be used to compose modules with. Modules are either written in-house or downloaded from\u00a0PuppetForge. Some modules from Puppetforge are exceptionally well written (ex: puppet-docker)<\/li>\n<li>In Ansible, there is\u00a0an extensive STDLIB of Ansible modules\u00a0automatically included as part of the Ansible installation. There is also a site for community written \u201croles\u201d called\u00a0Ansible Galaxy.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Language Extensibility<\/p>\n<ul>\n<li>Puppet is built on\u00a0Ruby\u00a0and the Ruby ecosystem of tools\u00a0for testing<\/li>\n<li>Ansible is built upon Python<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Syntax<\/p>\n<ul>\n<li>Puppet has\u00a0its own DSL,\u00a0which is a subset of Ruby. It\u2019s not a Turing-complete language and was specifically designed to \u201cbe accessible to sysadmins\u201c<\/li>\n<li>Ansible\u00a0playbooks are YAML files<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Template Language<\/p>\n<ul>\n<li>Puppet templates are based upon Ruby\u2019s ERB<\/li>\n<li>Ansible templates are based upon\u00a0Jinja2, which is a superset of Django\u2019s templating language<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>DevOps Tool Support<\/p>\n<ul>\n<li>Both Puppet &amp; Ansible are well supported by other DevOps tools like\u00a0Vagrant, Packer and\u00a0Jenkins<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>These were the features of both Puppet and Ansible. Now, lets discuss a little about the pros and cons of using them.<\/p>\n<p>Puppet<\/p>\n<p>Pros:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Has the biggest community<\/li>\n<li>Arguably carries the most mature Windows support<\/li>\n<li>Puppet is well established and you have some quality paid support options if you want to go that route<\/li>\n<li>Forge provides rich knowledge of resourses<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Cons:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Puppet comes with its own DSL called PuppetScript, which \u00a0is unique in its own form.<\/li>\n<li>Puppet&#8217;s error reporting has been always a pain point and one of the reasons for people switch<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Ansible<\/p>\n<p>Pros:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Basically automates configuration via pushing commands through SSH. No agents are required for managing clients<\/li>\n<li>It has a very active community and it is very easy to pick up because of both YAML &amp; Agentless architecture<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Cons:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>For advanced operations, it uses Jinja2 template language for python, for complex infrastructure code this is used a lot and it makes it much less readable and more complex.<\/li>\n<li>Because of the agentless architecture, management on bigger scales are extremely painful.<\/li>\n<li>It has a very immature Windows support.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><b>Community Metrics: Comparing Ansible, Chef, Puppet and Salt<\/b><\/p>\n<p><a href=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/pic11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5215 size-full\" src=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/pic11.png\" alt=\"pic1\" width=\"569\" height=\"353\" \/><\/a><\/p>\n<p><a href=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/pic21.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5216 size-full\" src=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/pic21.png\" alt=\"pic2\" width=\"569\" height=\"353\" \/><\/a><\/p>\n<p><a href=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/pic31.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5217 size-full\" src=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/pic31.png\" alt=\"pic3\" width=\"569\" height=\"353\" \/><\/a><\/p>\n<h2>Age, Language, and Community<\/h2>\n<p>&nbsp;<\/p>\n<table width=\"593\">\n<thead>\n<tr>\n<td><strong>\u00a0<\/strong><\/td>\n<td><strong>Ansible<\/strong><\/td>\n<td><strong>Puppet<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Age<\/td>\n<td>3yrs<\/td>\n<td>10yrs<\/td>\n<\/tr>\n<tr>\n<td>Language<\/td>\n<td>Python<\/td>\n<td>Ruby<\/td>\n<\/tr>\n<tr>\n<td>People<\/td>\n<td>1,060<\/td>\n<td>376<\/td>\n<\/tr>\n<tr>\n<td>Commits<\/td>\n<td>14,366<\/td>\n<td>20,210<\/td>\n<\/tr>\n<tr>\n<td>% by 1<\/td>\n<td>18.6%<\/td>\n<td>17.7%<\/td>\n<\/tr>\n<tr>\n<td>% by 6<\/td>\n<td>34.2%<\/td>\n<td>37.4%<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>Terms used in the above chat<\/p>\n<p>Age: It referes to the age of the CM from when it was found to 2015, based on the \u201cfirst release\u201d dates found on wikipedia.<\/p>\n<p>Language: referes to the language CM tools are written in<\/p>\n<p>People: shows how many people have contributed in GitHub repository<\/p>\n<p>Commits: Total number of Commits to the sourse code of each CM<\/p>\n","protected":false},"author":219,"featured_media":0,"parent":0,"comment_status":"open","ping_status":"open","template":"","blog_category":[3607],"user_email":"prarthitm@cloudthat.com","published_by":"324","primary-authors":"","secondary-authors":"","acf":[],"_links":{"self":[{"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/blog\/5213"}],"collection":[{"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/users\/219"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/comments?post=5213"}],"version-history":[{"count":1,"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/blog\/5213\/revisions"}],"predecessor-version":[{"id":46226,"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/blog\/5213\/revisions\/46226"}],"wp:attachment":[{"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/media?parent=5213"}],"wp:term":[{"taxonomy":"blog_category","embeddable":true,"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/blog_category?post=5213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}