Day 14 | Configuration Management | Ansible vs Puppet

Sarat MotamarriSarat Motamarri
9 min read

What is Configuration Management?

Configuration management is like having a magical recipe book for a tech-savvy kitchen. Imagine you're not just baking cookies but also cooking up entire feasts with a myriad of dishes. You've got a pot of soup, a sizzling steak, and a dessert that defies gravity. Now, how to make sure everything turns out perfectly, every time, even when you've invited a crowd of hungry guests?

That's where the magical recipe book (configuration management) comes into play. It's not an ordinary cookbook; it's like an enchanted spellbook that makes the kitchen creations consistent, reproducible, and oh-so-delicious.

Let's illustrate this with a simple tech twist:

Example: The Chefy Deployment Feast

You're the head chef of an app, and your goal is to serve your delicious app to your customers. But it's not just one dish; it's an entire feast of features, databases, servers, and more. And you need to do this every day, several times a day. Oh my, that's a lot of cooking!

Without Configuration Management: Imagine doing this manually, every time:

  • You're chopping ingredients (writing code) and seasoning them (configuring servers).

  • You're heating the stove (deploying servers), and sometimes it's too hot (oops, server crashed!).

  • You're serving a feast, but the desserts are salads, and the soups are ice cream.

It's chaos! Your customers are getting unpredictable meals, and you're stressed out.

With Configuration Management: Now, let's bring in our magical recipe book (configuration management):

  • You've written down your recipes (code and configurations) and kept them in a secure place.

  • Every time you want to serve the feast, you follow the recipes step by step.

  • You let your magical chef's hat (configuration management tool) handle the chopping, cooking, and serving.

Voilà! Your customers are delighted with a consistent, well-prepared feast every time, and you're a stress-free chef!

Configuration management tools like Ansible, Chef and Puppet act as your magical chef's hat. They automate the process, ensuring the infrastructure and applications are set up correctly, reliably, and consistently. No more serving up salads when you intend to serve desserts! Your tech kitchen runs smoothly, and you can focus on creating the best dishes for your customers. 🍽️✨

In other words, years ago, even before DevOps engineers evolved, system admins, were responsible for upgrading, installing secure patches, installation of DB servers for their on-premises servers. (On-premises servers are nothing but Data Center's. These Data Center's used to host several servers, Let say there are 100 servers of them 50 are Windows servers, 25 are CentOS, and 25 are Ubuntu.)

In order, to install these secure patches, or upgrade servers, these sys admins used to develop a script that will automate the process. But again, since, each server is different like some are Windows, some are Ubuntu, and some are CentOS, so they have to switch to several scripting languages.

To address, this issue, here comes the concept of CONFIGURATION MANAGEMENT.

Configuration Management refers to the practice of managing and maintaining the configuration and state of software, infrastructure, and systems to ensure consistency, reliability, and repeatability throughout the software development and delivery lifecycle.

Ansible was developed by RedHat. While each of these tools(like Puppet, Chef, and Salt) has its strengths, Ansible has gained popularity for several reasons:

  1. Agentless Architecture: Ansible is known for its agentless architecture, which means it doesn't require any agents or additional software to be installed on managed nodes. This makes it relatively easy to set up and manage, as you don't need to maintain and update agents on every target system. Agentless architecture is often seen as more lightweight and non-intrusive.

    Example: Think of a TV remote control. You don't need to attach any extra devices to your TV to make the remote work. It communicates directly without any extra stuff. Ansible works similarly, connecting to computers and making changes without needing extra software on them.

  2. Simplicity and Ease of Use: Ansible uses a simple and human-readable YAML syntax for defining automation tasks and configurations. This makes it accessible to a wide range of users, from beginners to experts. The learning curve for Ansible is generally considered to be less steep compared to some other tools.

    Example: Ansible uses a language that's as simple as writing a shopping list. One doesn't even need to be a computer expert to understand and use it. Here's what an Ansible task looks like in plain language: "Install a program called 'Chrome' on the computer."

  3. SSH and WinRM Support: Ansible primarily uses SSH for Linux/Unix systems and WinRM for Windows systems to connect to managed nodes. This makes it platform-agnostic and capable of managing a diverse range of systems.

    Example: Imagine using a key to unlock a door (SSH) or pressing a button on a remote control (WinRM) to control a TV. Ansible can use these methods to connect to different types of computers and control them.

  4. Idempotence: Like other configuration management tools, Ansible enforces idempotence, meaning that running a task multiple times will result in the same state. This helps ensure consistent system configurations and reduces the risk of unintended changes.

    Example: It's like brushing your teeth. If you brush your teeth once or ten times, your teeth will be clean and healthy. Ansible ensures that no matter how many times you run a task, the system stays in the same good state.

  5. Large and Active Community: Ansible has a vibrant and active user community, which means there are plenty of resources, modules, and playbooks available. You can find a wide range of pre-built Ansible roles and playbooks for common tasks and services.

    Example: Think of a big library filled with books on all sorts of topics. Ansible users have written many 'how-to' guides and shared them online. You can use these guides to learn how to do almost anything with Ansible.

  6. Integration and Extensibility: Ansible can be easily integrated with other tools and services. It has built-in modules for cloud providers, network devices, databases, and more. You can also extend its functionality by writing custom modules.

    Example: It's like adding new tools to a Swiss Army knife. Ansible can easily connect to many different things like cloud services, databases, and more. You can also create your special tools to use with it.

  7. Declarative Language: Ansible uses a declarative approach, allowing you to define the desired state of the system rather than specifying the steps to reach that state. This approach can be more intuitive for many users.

    Example: When you order a pizza, you say what kind of pizza you want, and the pizza place makes it that way. You don't need to tell them how to make it step by step. Ansible works the same way. You say what you want the system to look like, and Ansible makes it happen.

  8. Push and Pull Modes: Ansible supports both push and pull modes. In push mode, it pushes configurations to target nodes, while in pull mode, managed nodes pull configurations from a central server. This flexibility allows for various deployment models.

    Example: Think of sending a message. In push mode, you send the message to someone. In pull mode, they check for messages on their own. Ansible can either send instructions to computers (push) or let computers check for instructions (pull).

  9. Frequent Updates and Releases: Ansible is actively maintained and frequently updated, adding new features and improvements.

    Example: Think of your phone getting regular updates with new features. Ansible is like software that gets better all the time. People keep working on it, fixing problems, and adding new things.

The popularity of Ansible is a result of its user-friendly design and the broad range of tasks it can handle efficiently.

ANSIBLE GALAXY:

Ansible Galaxy is like a magic store for Ansible, where you can find, share, and use pre-made automation scripts and tools. It's a place where you can grab ready-to-use solutions and supercharge your automation tasks. People can share their own developed, customized modules.

  1. Role Repository:

    • Example: Think of Ansible Galaxy as a supermarket for ready-made meals. Instead of starting from scratch, you can pick up a 'role' (recipe) to cook a specific dish (automation task). For instance, you can find a 'web server role' that helps you set up a web server without figuring it all out on your own.
  2. Open Source Community:

    • Example: Imagine a big potluck party where everyone brings a dish to share. In Ansible Galaxy, people from all over the world bring their 'recipes' (roles) to share with the community. You can benefit from their work and even contribute your own 'dishes' (roles) to the potluck.
  3. Structured and Reusable:

    • Example: Ansible Galaxy roles are like Lego blocks. They're pre-built pieces you can easily snap together to create something amazing. For instance, if you need to build a 'car' (automation task), you can use 'wheels' and 'bricks' (roles) from Ansible Galaxy to save time.
  4. Installation and Management:

    • Example: To use an Ansible Galaxy role, you simply download it and place it in your 'kitchen' (Ansible project directory). Just like adding a new spice to your spice rack. Then, when you need to use that spice in your recipes (playbooks), it's right there at your fingertips.
  5. Version Control:

    • Example: Think of Ansible Galaxy roles as different editions of your favourite books. Just like you can have the first edition, second edition, and so on, Ansible Galaxy roles have versions. You can choose the right 'edition' (version) of a role to make sure your 'story' (automation) turns out just the way you want it.
  6. Dependencies Management:

    • Example: Imagine building a sandwich. You might need bread, lettuce, and tomatoes. In Ansible Galaxy, a role can tell you, "I need this kind of bread, that type of lettuce, and those specific tomatoes." Ansible Galaxy helps make sure you have all the right ingredients (dependencies) for your 'meal' (automation task).
  7. Community Rating and Reviews:

    • Example: Think of Ansible Galaxy as a restaurant with ratings and reviews. Before choosing a place to eat, you can see what others have said about it. Similarly, Ansible Galaxy roles come with ratings and comments from others who have used them. You can pick roles that are highly recommended.
  8. Discovery and Sharing:

    • Example: The Ansible Galaxy is like a treasure map. It helps you discover hidden treasures (roles) made by other adventurers (Ansible users). You can also be an adventurer and share your treasures on the map for others to find.

In summary, Ansible Galaxy is the ultimate store for finding, sharing, and using pre-made automation solutions. It's a place where you can shop for 'recipes,' join a global potluck of ideas, and make your automation tasks easier and more efficient. So, whether you're a chef in the kitchen or an automation enthusiast, Ansible Galaxy is your one-stop shop for saving time and effort in your automation adventures! 🌌🍽️

0
Subscribe to my newsletter

Read articles from Sarat Motamarri directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sarat Motamarri
Sarat Motamarri

Hey there, I'm Sarat Motamarri, an aspiring engineer mastering the art of DevOps & AWS. If you're as passionate about the cloud and open-source wizardry as I am, you're in the right place! Let's explore the skies together 🚀🔮 #CloudEnthusiast #DevOpsDreamer"