Ansible Installation and Software Deployment Guide

Kuldip Mori
3 min readAug 16, 2023

--

The Ansible Installation and Software Deployment Guide. This document will walk you through the process of installing Ansible on your local Linux machine and using it to manage software installations. Ansible is a robust automation tool designed to streamline configuration management and application deployment across multiple servers.

This Ansible-Playbook May helps in Your day to day installation steps and common setup for DevOps Task, System Manager and S.R.E. Role.

Prerequisites

Before you embark on this journey, please make sure you have the following prerequisites in place:

  • A local Linux machine (such as Ubuntu or CentOS) with root or sudo access.
  • Internet connectivity to download Ansible and necessary software packages.
  • Basic familiarity with the Linux command line.

Installing Ansible on Linux

To set up Ansible on your Linux machine, follow these straightforward steps:

  1. Add the Ansible repository to your system’s package manager:
sudo apt-add-repository ppa:ansible/ansible

2. Update the package lists to include the new repository:

sudo apt update

3. Install Ansible:

sudo apt install ansible

4. Verify the Ansible installation by checking the version:

ansible --version

You should see information about the installed Ansible version, confirming the successful installation.

Setting up the Ansible-Hosts File

The /etc/ansible/hosts file functions as the inventory file that Ansible uses to define and organize the hosts (remote servers) it manages. This text file lists the host-names or IP addresses of remote servers and groups them together.

For external servers, update the target server name and IP(s):

sudo nano /etc/ansible/hosts
# Ansible Target Server
[target-server]
13.200.130.21

For Install in local machine:

sudo nano /etc/ansible/hosts
# Ansible LocalHost Server
[localhost]
127.0.0.1 ansible_connection=local

Cloning the Code

To proceed with the software installation process, clone the required code onto your local machine:

git clone https://github.com/kuldipmori/ansible-software-install.git

Navigate to the cloned directory:

cd ansible-software-install

Execute the playbook:

sudo ansible-playbook *.yaml

package-management

The package-management directory plays a pivotal role in orchestrating package management tasks tailored to your system's package manager, APT. This playbook, aptly named apt-manage.yaml, streamlines various operations, including updating the package cache, upgrading packages to their latest versions, or selectively removing unnecessary packages. By leveraging Ansible's automation prowess, this playbook ensures that your system's software components remain up-to-date and optimized.

software-install

Delving into the software-install directory, you'll uncover a trove of playbooks: chrome-install.yaml, anydesk-install.yaml, and vscode-install.yaml. These meticulously crafted playbooks facilitate the installation and meticulous configuration of specialized software packages. Examples include the immensely popular Google Chrome browser and the versatile Visual Studio Code. By employing Ansible's systematic approach, you can seamlessly deploy these tools with precision, ensuring that your development environment remains finely tuned and productive.

web-server

Navigate to the web-server directory to explore the nginx-install.yaml and apache2-install.yaml playbooks. These playbooks are meticulously designed to streamline the intricate process of installing and configuring web servers, with a keen focus on Nginx. They encompass an array of tasks, ranging from essential package installation to intricate configuration adjustments. Ansible's orchestration ensures a smooth, automated setup, allowing you to effortlessly establish a robust web server environment that serves your applications with efficiency and reliability.

cache-service

Experience the effortless deployment of a Redis cache server through Ansible’s magic within the cache-service directory. The redis-install.yaml playbook holds the key to simplifying the establishment of Redis servers and command-line interfaces on your target servers. Ansible's automation handles the intricate setup process, freeing you from the complexities of manual configuration. Redis, a high-performance in-memory data store, becomes an integral part of your infrastructure with minimal effort, thanks to Ansible's prowess.

database-install

For database aficionados, the database-install directory brings a realm of automation possibilities. The playbook within orchestrates the installation of PostgreSQL and MySQL database environments with utmost ease. Not only does this playbook set up the core database systems, but it also automates the creation of a root user complete with a securely managed password. By embracing Ansible's streamlined automation, you can effortlessly establish a robust database foundation, leaving you more time to focus on application development and less on manual setup.

For the further help or suggestion you can ping me on LinkedIn or Mail.

--

--

Kuldip Mori
Kuldip Mori

Written by Kuldip Mori

DevOps engineer — Ahemdabad

No responses yet