Ansible for Beginners pt.1: Basics of Ansible
1.1 What is Ansible?
Ansible is a modern and open source IT automation orchestration and provisioning tool which makes your work easier. It manages servers serviceless. You just need to define a list of all instruction you are interested and ansible will go and do it for you. Ansible is always ready to manage your servers, does not matter if it is to install a package, update a configuration or even restart a service.
Ansible uses playbook files to describe automation jobs, and playbooks are written in very simple language called YAML. YAML is a human-readable data serialization language and is commonly used for configuration files, but could be used in many applications where data is being stored. It is very easy for humans to understand, read and write. Hence the advantage is that even the non IT support guys can read and understand the playbook and debug if needed.
After connecting to your servers, Ansible pushes small programs called as “Ansible Modules”. Ansible runs that modules on your servers and removes them when finished. Information for all servers, such as IP, ssh credentials, etc. are stored in inventory. This is one or a couple of text files. The content could be written in ini or yaml format. Ansible uses the hosts file where you can group the hosts and can control the actions on a specific group in the playbooks.
1.2 Why do we need it?
Managing a server is easy. Managing 10 is possible. Managing hundreds or more is a painful task without automation. Ansible is designed to be simple and effective. You can create identical, replicable servers and clusters of servers.
Ansible is designed for multi-tier deployment. Ansible does not manage one system at time, it models IT infrastructure by describing all of your systems are related and is run against a multiple hosts at a time. Ansible is completely agent less which means it could works by connecting your servers through ssh(by default). But there are other methods for connection like Kerberos
1.3 What are the advantages of using it?
Ansible manages machines in an agent-less manner. You do not need to have anything installed on the client’s end. However both push and pull mode are supported. Ansible is a security focused tool. It uses OpenSSH as transport protocol. Ansible playbooks are written in YAML and are easy to read. If needed, Ansible can easily connect with Kerberos, LDAP, and other centralized authentication management systems.
1.4 How to install Ansible?
Package managers like dnf, yum, zypper or apt can be used.
• On Fedora machines:
|dnf install ansible|
• On CentOS machines
yum install epel-release
yum install ansible
• On openSuse machines
|zypper install ansible|
Morе on the topic coming soon!
2. Inventory Setup
3. Ad-hoc commands
4. YAML Basics