Ansible — Overview & Installation
A story to provide a brief introduction of Ansible, installation & setup.
Overview
In today’s world, everyone is looking out to reduce human efforts and to eliminate monotonous work. The trend has been also taken a pace in modern IT industries as most of the firms are now looking out for various tools and technologies to cut down the manual repetitive work.
Ansible is one of the leading tools that is adopted by most IT practitioners as can be used for orchestration, configuration management, provisioning & multi-layer deployments.
Ansible is popular due to its agentless architecture, a user-friendly setup that uses SSH for communication between master and client nodes and more importantly no extra overhead of running CPU and memory extensive daemons and processes.
Ansible Benefits
- Agentless, minimal setup
- Scalable
- Secure as uses SSH for communication across nodes
- User-friendly, simple and fast
Ansible Components
- Modules → Predefined customized piece of code to perform various actions
- Tasks → A call to a module to perform a specific job
- Inventory → List of target hosts
- Playbook → Collection of ansible tasks and commands
Ansible Architecture
Ansible is based on the client & server model i.e. in an ansible we have a master node(also known as control node) and one or many client nodes(also known as managed or target hosts).
Ansible is basically installed on the master node and all components are maintained on it, e.g. a host inventory containing a list of all the target hosts i.e. client hostname or IP addresses Or the playbooks i.e. having one/multiple tasks to perform on target hosts, etc.
Ansible Installation
Ansible can be installed in many ways i.e. via using a package manager like yum, apt, deb, etc. and also via python package manager i.e. pip or via downloading rpm & tarballs.
- Installation via PIP
1.1 Install pip if not already installed
teckdevOps$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pyteckdevOps$ python get-pip.py
1.2 Install ansible
teckdevOps$ pip install ansibleteckdevOps$ ansible --version
1.3 Uninstallation
teckdevOps$ pip uninstall ansible
2. Installation via yum/apt
2.1 On RHEL/Centos/Fedora
teckdevOps$ yum update -yteckdevOps$ yum install ansible
2.2 On Ubuntu
teckdevOps$ apt update -y
teckdevOps$ apt install software-properties-common
teckdevOps$ apt-add-repository --yes --update ppa:ansible/ansible
teckdevOps$ apt install ansible
2.3 Uninstallation
YUM
teckdevOps$ yum remove ansibleAPT
teckdevOps$ apt remove ansible
Now that you have Ansible installed, you can start playing around with Ansible commands, tasks and playbooks Or follow up my upcoming blogs to explore more of ansible.
Thanks, Happy Reading!
— A blog by teckdevOps