DEV Community

loading...
Cover image for Ansible

Ansible

inesattia profile image Ines Updated on ・3 min read

Let ’s begin with automation’s meaning

In general automation means completing a single task or function without human intervention. Executed wisely, automation makes traditionally time-intensive, manual processes more efficient.In IT, it’s possible to automate a wide range of processes and tasks, from app deployment and integration, to securing endpoints .
In cloud automation, for instance, you might use automation tools and machine learning to dynamically deploy assets to the cloud, manage cloud computing workloads.

What is ansible?

Ansible is a simple IT automation platform that makes your applications and systems easier to deploy.Let's avoid writing scripts or custom code to deploy and update your applications we can automate in a human-readable data-serialization language 'YAML’, using SSH, with no agents to install on remote systems.

Developers describe Ansible as "Radically simple configuration-management, application deployment, task-execution, and multi-node orchestration engine”

ABRA Ansible DABRA

IT WORKS LIKE MAGIC!!
Alt text of image

What we can automate with Ansible ?

 Ansible automates cloud provisioning, configuration management, application deployment, infrastructure , applications, networks, security and even cloud , orchestrate more advanced IT tasks such as continuous deployments.

Ansible's mechanism

One Ansible Control Node( configured to automate,First it connects to your nodes,second it pushes out small program finally it executes program over ssh by default) connected to one or more Ansible Hosts

Why Ansible is “mon coup de coeur” my favorite automation’s tool?

What if I told you that there is a tool : open-source,with simple command you install it and with yaml language you write your playbooks .

Ansible is:
    * Free
* Simple to setup and use
* Powerful
* Flexible
* Agentless
* Efficient




Not only for me Ansible is the favorite automation's tool !!!

  • Every single week, both the full and mobile versions of www.nasa.gov are updated via Ansible, generally only taking about 5 minutes to do. 
  • It is also being used to re-mediate security issues and was leveraged to re-mediate OpenSSL issues.
  • NASA web app servers are being patched routinely and automatically through Ansible Tower with a very simple 10-line Ansible playbook.
“Let’s let the computers do the tasks that are mundane and that we shouldn’t be spending time on … so that way we can focus on the things that are important to us,” Barr says.
“One of the reasons Ansible is winning the day against other automation mechanisms is that it is significantly easier for an untrained operations-type person that is not a coder to be able to automate using Ansible,” explains Steven Carter, chief cloud architect for Red Hat’s public sector.

Let’s save time and make our life easier , let’s write our own playbooks and automate with Ansible .

Beginning with installing and configuring Ansible
For all major platforms you can follow this link

Terms to know before writing your playbooks

Playbook : The yml file where ansible commands are written .
Tasks: An action managed by ansible .
Inventory: It is a configuration file where you define the host information.
Plays: Essentially groups of tasks that are performed on defined hosts to enforce your defined functions ; example: – hosts: all
Roles: It is the Ansible way of bundling automation content and making it reusable.
Handlers: It is similar to tasks except that a handler will be executed only when it is called by an event, like restarting or stopping a service.
Package management: There is a module for most popular package managers, like YUM and APT …, to enable you to install any package on a system. Functionality depends entirely on the package manager, but usually these modules can install, upgrade, downgrade, remove, and list packages.

In conclusion here is my example ;
The controller machine (ubuntu 18.04) and the target hosts are Centos VMs, many instances running on private cloud infrastructure made with openstack.
Every centos VM contains :
*webserver "Apache".
*Management logs service "ELK" (used to manage logs of apache).
*Video conference Service "Openmeetings"
With raspberry working as "Pihole" like traffic light managed from dashboard.All these services are automated via playbooks and even the creationg of the Centos instance is automated .
Follow this link

Discussion (0)

pic
Editor guide