Table of contents
What is Configuration Management?
Configuration management in terms of Ansible means that it maintains the configuration of the product performance by keeping a record and updating detailed information that describes an enterprise’s hardware and software.
Which domain do they use Ansible?
In IT companies, infrastructure domain support teams, Linux systems
What kind of configuration management support does this tool provide?
This tool is useful for configuration of servers, application deployment, and continuous testing of installed applications
What is Ansible?
Ansible is an open-source IT configuration management, deployment, and orchestration tool. You can provide a variety of automation challenges with this. You can manage 10,000 to 20,000 servers. This tool is useful for managing complex multi-tier IT applications, automating tasks, multiple servers
You need to have 3 basic knowledge to know about Ansible
Linux commands
How to work in ansible
Python basics
Interview Perspective: Devops Engineer can automate all the repetitive tasks that we do every day using Ansible
Ansible is an open-source Configuration management tool used to automate infrastructure management and configuration. Using Ansible we can configure hundreds and thousands of servers with a single command.
How Does Ansible Work?
Ansible uses something called Playbook which is written in YAML Syntax where you can define all your tasks and configurations that you want to be applied on all the servers.
Along with the playbook you also need a host file or inventory file, which will contain the IP Addresses of all the servers on which you want to run the playbook
After you have the playbook and define your servers in the host file, you can run the ansible command, which will run the playbook on all the servers defined in the host file using SSH.
This is how Ansible can be used to manage and configure multiple servers at once
𝐖𝐡𝐚𝐭 𝐢𝐬 𝐀𝐧𝐬𝐢𝐛𝐥𝐞 𝐫𝐨𝐥𝐞𝐬?
Ansible Roles provides a clear framework and structure for configuring tasks, variables, handlers, metadata, templates, and other files. They allow us to reuse and share our Ansible code efficiently.
Ansible is written in which language?
Mostly Python and Powershell
Why Ansible?
It is a free open-source application
Agent-less-No need for agent installation and management
Python /Yaml based
High flexibility and configuration management of systems.
A large number of ready-to-use modules for system management
Configuration roll-back in case of error
Very simple to set up and use (No special coding skills are necessary to use Ansible’s playbooks.)
Powerful (Ansible lets you model even highly complex IT workflows)
Efficient( Because you don’t need to install any extra software, there’s more room for application resources on your server)
SSH(Very simple password-less network authentication protocol which is secure. So, your responsibility is to copy this key to the client)
Advantage
Agentless (No special software required on remote machines)easy
Security
Simplicity (Playbooks written in human-readable YAML)
Modules and plugins
Comprehensive tool network automation
cloud and local infrastructure automation
Architecture of Ansible
The architecture of Ansible consists of several key components that work together to automate and manage IT infrastructure. Here are the components
Control Node: Where Ansible is installed and from which automation tasks are executed.
Inventory: Lists managed hosts (nodes) categorized into groups.
Playbooks: Written in YAML to define tasks and configurations.
Modules: Small programs executed on managed hosts for tasks.
Roles: organize and reuse playbooks and associated files.
Handlers: Special tasks executed when notified by other tasks.
Facts: Variables gathered from managed hosts
Ad-Hoc Commands: For quick one-time tasks from the command line.
Ansible Tower (Optional): A web-based automation orchestration tool for managing Ansible at scale.
Ansible Supported Modules
There are n number of modules, some of which are
Cloud Modules (AWS, Azure, GCP)
Notification Modules (Slack, Email, Hipchat, Webhooks)
Network Modules
Database Modules
System Modules
Basic Ansible-Commands
• ansible - Ansible ad-hoc commands
• ansible-playbook - Run an Ansible playbook
• ansible-vault - Manage encrypted Ansible vars files
• ansible-galaxy - Manage roles using galaxy.ansible.com
• ansible-doc - Show documentation on Ansible commands
• ansible-pull - Pull playbooks from the server
How is Ansible different from other automation tools? (e.g. Chef, Puppet, etc.)
Agentless
Minimal run requirements (Python & SSH) and simple to use
The default mode is "push" (it supports also pull)
Focus on simplicity and ease of use