Ansible...Installation Process

In this chapter, we will learn about the environment setup of Ansible.

Installation Process 

Mainly, there are two types of machines when we talk about Ansible deployment

Control machine − Machine from where we can manage other machines.
Remote machine − Machines which are handled/controlled by control machine.

Multiple remote machines can be handled by one control machine. So for managing remote machines we have to install Ansible on control machine.

Control Machine Requirements

Ansible can be run from any machine with Python 2 or higher version of Python installed.

By default, Ansible uses ssh to manage remote machine.

Ansible does not add any database. It does not require any daemons to start or keep it running.
While managing remote machines, Ansible does not leave any software installed or running on them. Hence, there is no question of how to upgrade it when moving to a new version.

Ansible can be installed on control machine which have above mentioned requirements in different ways.
You can install the latest release through Apt, yum, pkg, pip etc

Note − Windows does not support control machine.

Ansible...Automation Tool

Introduction

Ansible is an open source, powerful automation software for configuring, managing and deploying software applications on nodes without any downtime just by using SSH
Ansible is simple open source IT engine which automates application deployment
Ansible is easy to deploy because it does not use any agents or custom security infrastructure.
Ansible is designed for multi-tier deployment
After connecting to your nodes, Ansible pushes small programs called as “Ansible Modules”
Ansible runs that modules on your nodes and removes them when finished. Ansible manages your inventory in simple text files (These are the hosts file)
Ansible uses the hosts file where one can group the hosts and can control the actions on a specific group in the playbooks

How Ansible works

There are many similar automation tools available like Puppet, Chef, Salt etc, but Ansible categorize into two types of server: controlling machines and nodes

The controlling machine, where Ansible is installed and Nodes are managed by this controlling machine over SSH
The location of nodes are specified by controlling machine through its inventory.

Ansible is agent-less, that means no need of any agent installation on remote nodes
Ansible can handle multiple nodes from a single system over SSH connection and the entire operation can be handled and executed by single command ‘ansible’

In some cases, where you required to execute multiple commands for a deployment, here we can build playbooks
Playbooks are bunch of commands which can perform multiple tasks and each playbooks are in YAML file format

YAML (It’s 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) which is very easy for humans to understand, read and write.
Hence the advantage is that even the IT infrastructure support guys can read and understand the playbook and debug if needed (YAML – It is in human readable form)

Use of Ansible

Ansible can be used in IT infrastructure to manage and deploy software applications to remote nodes
For example, let’s say you need to deploy a single software or multiple software to multiple nodes by a single command,
Here Ansible comes into picture, with the help of Ansible you can deploy as many applications to multiple nodes with one single command. You must have a little programming knowledge for understanding ansible script

How to fix: ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

Open your terminal and type mysql -u root -p Enter your password. Hopefully your MySQL is logged in now.