What is Ansible ?

What is Ansible ?

What is Ansible ? | Varchasv Hoon

Ansible

Ansible is an Open Source tool that automates deployments, orchestration and cloud provisioning. It uses playbooks to execute commands that are written in a human-readable language called YAML.

With Ansible, users can easily define infrastructure as code, making it easy to manage and track changes over time. Ansible also supports a wide range of platforms and operating systems, making it a versatile tool that can be used to automate tasks across multiple environments.

Features

  1. Agentless - No Agent Installation is needed.

  2. Feature Rich - Built on Python.

  3. Secure - Uses SSH.

  4. Push-Based Architecture - Changes can be pushed all at once simultaneously.


Ansible Architecture

  • Users: Those who are responsible for creating Ansible Playbooks and have a connection with the Ansible automation engine.

  • Playbooks: A set of commands to be executed on either one or many hosts. Generally used to automate repetitive tasks.

  • Inventory: List of IP addresses of all the hosts.

  • Modules: A reusable piece of code that performs a specific task such as installing packages, creating users, copying files, and running commands on a remote host.

  • API's: Collection of programming interfaces that allow Ansible to be used as an automation engine from other software applications or systems.

  • Plugins: A piece of code that extends or modifies Ansible's core functionality. Plugins can be used to customize or extend Ansible's behavior, or to add new features and capabilities to the tool.

  • CMDB (Configuration Management DataBase): It is a database that stores information about the configuration items.

  • Hosts: They refer to the machines like Linux or Unix machines which are getting automated using Ansible.


Used in

  • App Deployment

  • Orchestration

  • Configuration Management

  • Provisioning

  • Security and Compliance


Sample Playbook

The following is a sample playbook to install Apache2.

---
- name: Install Apache
  hosts: all
  become: true

  tasks:
  - name: Update apt cache
    apt:
      update_cache: yes

  - name: Install Apache
    apt:
      name: apache2
      state: present

  - name: Start Apache
    service:
      name: apache2
      state: started
      enabled: true
---

Installing Ansible

After getting a brief introduction to Ansible, if you do wish to install it, then you can follow the commands to do so.

  1. sudo apt-get update
  1. sudo apt-get install software-properties-common

  2. sudo apt-get-repository ppa: ansible/ansible

  3. sudo apt-get update

  4. sudo apt-get install ansible


Resources




Conclusion

That was it for this Blog post, if you liked it then please be sure to like and comment. Check out my socials and dm me for any feedback.

Support me by Sponsoring me, if you like my content and blog posts.

Subscribe to my newsletter to be up-to-date with my new blogs

Did you find this article valuable?

Support Varchasv Hoon by becoming a sponsor. Any amount is appreciated!